www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17188] New: `core.stdc.stdlib.qsort()` is broken

https://issues.dlang.org/show_bug.cgi?id=17188

          Issue ID: 17188
           Summary: `core.stdc.stdlib.qsort()` is broken
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: ketmar ketmar.no-ip.org

the following code doesn't compile anymore (git HEAD):


import core.stdc.stdlib;

extern(C) int cmp (const void *a, const void *b) { return 0; }

void main () {
  int[4] arr;
  qsort(arr.ptr, arr[0].sizeof, arr.length, &cmp);
}


...due to added `scope` in compare function prototype. i think we should not
break user's code right away, there should be a deprecation stage first.

--
Feb 15