[dmd-beta] rvalue references

Sean Kelly sean at invisibleduck.org
Sun Apr 15 09:07:03 PDT 2012


On Apr 13, 2012, at 1:48 PM, "Jonathan M Davis" <jmdavisProg at gmx.com> wrote:

> On Friday, April 13, 2012 22:18:16 Don Clugston wrote:
>> Interestingly, the ref int[3] idiom is documented as working, under
>> 'interfacing with C'.
>> Anything beyond that seems to be undefined.
>> That page seems to document dynamic arrays as _not_ working --
>> certainly as having no C equivalent.
> 
> Which seems really backwards considering that in both case, you'd be using T* 
> in C, and if anything, dynamic arrays are closer to that than static arrays. 
> Personally, I'd have expected arr.ptr to be required in both cases.

The problem is mostly with stuff like:

extern (C):
alias int[2] foo;
void fn(foo);

Now make the alias platform-dependent (as in the Posix package) and tell me what the prototype for fn() should be. Fortunately, static array args are almost nonexistent in C99 and Posix. 


More information about the dmd-beta mailing list