Passing static arrays to C
bearophile
bearophileHUGS at lycos.com
Wed Oct 24 11:16:05 PDT 2012
Walter Bright:
> In D, static arrays are passed by value, in C by pointer.
> Hence, you have a mismatch between the C and D prototypes of
> test1, and you'll get garbage results.
Isn't it possible to help the programmer avoid some similar
mistakes with some warnings or errors?
I think the extern(C) annotation, plus the function signatures,
give the D compiler all the info it needs.
Bye,
bearophile
More information about the Digitalmars-d
mailing list