On 24-10-2012 12:00, Era Scarecrow wrote:
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.

Passing static arrays by reference to the first element is part of the calling convention/ABI. If the C compiler generated code that doesn't work this way, the C compiler has a bug.

--
Alex Rønne Petersen
[email protected]
http://lycus.org

Reply via email to