DMD 1.022 and 2.005 releases

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Sat Oct 6 17:27:32 PDT 2007


Stewart Gordon wrote:
> "Stewart Gordon" <smjg_1998 at yahoo.com> wrote in message 
> news:fe6f68$1gm8$1 at digitalmars.com...
> <snip>
>> 3. How about making it so that D dynamic array parameters become, on 
>> the C++ side, two parameters: length and pointer?
> 
> I've just been thinking a bit more about this.  I guess it's just a 
> matter of name mangling - I haven't checked, but it would appear from 
> the old printf-on-strings issue that pushing two arguments in succession 
> is equivalent to pushing the concatenation of (the memory 
> representations of) them in one go.  (Is this platform dependent?)

With printf() it probably just works because it uses C-style varargs and 
the two elements of a char[] happen to both be the "native" size of the 
processor (so there's no padding inserted).
It may not even work on all platforms.

Also, AFAIK the compiler would be well within its rights to use the 
opposite order of .length and .ptr in memory; meaning that even if the C 
calling convention allows this the order they're passed in isn't guaranteed.



More information about the Digitalmars-d-announce mailing list