Passing static arrays to C
Era Scarecrow
rtcvb32 at yahoo.com
Wed Oct 24 03:00:28 PDT 2012
On Wednesday, 24 October 2012 at 09:16:30 UTC, Walter Bright
wrote:
> C accepts static arrays as pointers, so T[n] in D would be C
> prototyped as T*.
>
> Pass a pointer to the first element.
In GCC (or any c compiler) isn't it possible in optimizing to
copy the static array to the stack (say 8 bytes or less as a
guess)? Course this assumes the static size is set as part of the
function signature too...
It makes sense for it to work both ways (in their own way); But
then more bugs can lie in wait as well.
More information about the Digitalmars-d
mailing list