digitalmars.D.bugs - [Issue 6596] New: Error message with not extern(C) function
- d-bugmail puremagic.com (53/53) Sep 02 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6596
- d-bugmail puremagic.com (20/20) Sep 22 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6596
- d-bugmail puremagic.com (13/19) Sep 22 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6596
- d-bugmail puremagic.com (12/12) Sep 24 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6596
- d-bugmail puremagic.com (8/8) Sep 25 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6596
http://d.puremagic.com/issues/show_bug.cgi?id=6596 Summary: Error message with not extern(C) function Product: D Version: D2 Platform: All OS/Version: Windows Status: NEW Keywords: diagnostic Severity: minor Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: bearophile_hugs eml.cc This is a spin-off of bug 5069 (On request of yebblies too). This is a wrong D2 program: import std.c.stdlib: qsort; import std.c.stdio: printf; int compare(const void *a, const void *b) { return *cast(int*)a - *cast(int*)b; } void main () { int[] values = [40, 10, 100, 90, 20, 25]; for (int n = 0; n < 6; n++) printf ("%d ", values[n]); printf("\n"); qsort(values.ptr, 6, int.sizeof, &compare); for (int n = 0; n < 6; n++) printf ("%d ", values[n]); printf("\n"); } With dmd 2.055head it prints: test.d(11): Error: function core.stdc.stdlib.qsort (void* base, uint nmemb, uint size, int C function(in const(void*), in const(void*)) compar) is not callable using argument types (int*,int,uint,int function(in const(void*), in const(void*))) test.d(11): Error: cannot implicitly convert expression (& compare) of type int function(in const(void*), in const(void*)) to int C function(in const(void*), in const(void*)) I'd like it to print: int extern(C) function(in const(void*), in const(void*)) Instead of: int C function(in const(void*), in const(void*)) Because it's easy to miss a single C in the noise of the error message, and because it's closer to the code that you actually have to write. Even better is to produce a single error message, reducing the clutter: test.d(11): Error: cannot implicitly convert expression (&compare) of type int function(in const(void*), in const(void*)) to int extern(C) function(in const(void*), in const(void*)) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 02 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6596 Reduce test case: ---- extern (C) int function() pfunc; extern (C) int cfunc(){ return 0; } // current behavior static assert(typeof(pfunc).stringof == "int C function()"); static assert(typeof(cfunc).stringof == "intC ()"); // expect (1) static assert(typeof(pfunc).stringof == "int extern (C) function()"); static assert(typeof(cfunc).stringof == "int extern (C) ()"); // expect (2) static assert(typeof(pfunc).stringof == "extern (C) int function()"); static assert(typeof(cfunc).stringof == "extern (C) int()"); ---- -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 22 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6596 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch https://github.com/D-Programming-Language/dmd/pull/404 Implements:extern (C) int function() pfunc; extern (C) int cfunc(){ return 0; }[snip]// expect (2) static assert(typeof(pfunc).stringof == "extern (C) int function()"); static assert(typeof(cfunc).stringof == "extern (C) int()");-- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 22 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6596 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla digitalmars.com Resolution| |FIXED 21:03:16 PDT --- https://github.com/D-Programming-Language/dmd/commit/15f54382fb89671c1c640d8b7c11da3b3b923aa1 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 24 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6596 Thank you. But is "in const(void*)" correct? Aren't "in void*" or "const(void*)" or "const void*" enough? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 25 2011