WTF did happen with struct constructor and ref in 2.061 ?
Ali Çehreli
acehreli at yahoo.com
Sat Jan 5 22:14:56 PST 2013
On 01/05/2013 04:58 AM, js.mdnq wrote:
> S s = S(2); foo(s) <==> foo(S(2))
For those to be equivalent, there must be a scope around the first one:
{ S s = S(2); foo(s); } <==> foo(S(2))
I think that's what you've been proposing: The compiler could generate a
variable on the stack to be passed to the function that takes ref.
It would still have the problem of losing potential modifications to the
variable, which both C++ and D try to protect the programmer from.
Ali
More information about the Digitalmars-d
mailing list