On 05/16/2014 08:24 AM, Ali Çehreli wrote:
> On 05/16/2014 08:15 AM, Andrew Brown wrote:
> > void foo(ref int[3] a); // D prototype
> Since we know that references are implemented as pointers, 'ref int[3]
> a' is passed as a.ptr.
Sorry, that's confusing. Yes, it ends up being equal to a.ptr but
conceptually, the compiler does not pass .ptr directly; it passes the
address of the entire array. Since the address of the entire static
array is the same as the address of its first element it equals a.ptr
and works perfectly in the C land.
Ali