Negative

Walter Bright newshound at digitalmars.com
Wed Mar 1 12:07:19 PST 2006


"Stewart Gordon" <smjg_1998 at yahoo.com> wrote in message 
news:du4q5j$1ckc$1 at digitaldaemon.com...
> Moreover, while
>
>     auto Qwert yuiop = new Qwert;
>
> appears to be syntactic sugar for
>
>     Qwert yuiop = new Qwert;
>     on_scope_exit delete yuiop;

That's correct. In fact, it's implemented that way <g>.

> the former does still (I assume) have the advantage of stopping you from 
> inadvertently reassigning to yuiop.

Yes, whereas the latter allows state unwinding for things that aren't class 
objects. Without on_scope_exit, extra dummy classes would have to be defined 
for each, turning a one liner into a dozen lines that appear out of context. 





More information about the Digitalmars-d mailing list