On 8/14/11 12:39 PM, dsimcha wrote:
On 8/14/2011 1:05 PM, Andrei Alexandrescu wrote:
Pass-by-pointer is really, really ugly when used in high-level D-style
code, and exposes the implementation detail that the D wrapper is using
C code. By explicit cast, do you mean one in dWrapper() that's
encapsulated and invisible to the caller?

Yah, dWrapper would become:

void dWrapper(ref int a, ref int b) {
cFun(cast(int*) &a, cast(int*) &b);
}

If the casts are missing, the compiler's error message could clarify
under what assumptions they might be inserted.

Ok, IIUC we might have found some common ground here. Is the idea that,
if you insert the cast, then it's an unsafe cast and you're free to take
the address of a ref parameter, period?
[snip]

Everything sounds great, thanks.

Andrei

Reply via email to