[Issue 3604] extern(C) callable function with array parameters broken

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Dec 11 06:22:50 PST 2009


http://d.puremagic.com/issues/show_bug.cgi?id=3604



--- Comment #3 from Witold Baryluk <baryluk at smp.if.uj.edu.pl> 2009-12-11 06:22:49 PST ---
Changing declaration of pipe to
  extern(C) int pipe(int*);
will make that D type system have less information than previous.

currently, if I would write:
   extern(C) int pipe(int[2]);
   int[1] input;
   pipe(input);
it will fail to compile because of wrong type.

But with:
   extern(C) int pipe(int*);
   int[1] input;
   pipe(input.ptr);
it will compile without any error.

I see many other functions, in core which takes array of different sizes.

How about just interpreting array parametern in extern(C) function as being
passed via reference. I don't see what was wrong in previous approach. It gives
some more verbosity to error messages.

If anyway this is new intended behaviour, please document it and fix all
headers in core.* and other extern(C) headers.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list