Remove declaration 'auto' for RAII?

Jarrett Billingsley kb3ctd2 at yahoo.com
Mon Mar 13 06:04:58 PST 2006


"Chris Miller" <chris at dprogramming.com> wrote in message 
news:op.s6csodzipo9bzi at moe...
> There is a problem with auto when declaring variables!
>
> Not only does it have 2 meanings, but when using it for implicit type 
> inference, it no longer has the RAII quality. So if you say "auto foo = 1" 
> is much like "static bar = 1", you are mistaken. The 2nd one doesn't cause 
> it to be non-static, so why does the 1st make it non-RAII?
>
> If auto for implicit type inference stays, I propose removing it for RAII 
> in declarations. If you want RAII you can simply use scope(exit) delete 
> baz; after the declaration. Also, the "auto class {}" form can still stay 
> since it is in unrelated code and there is no easy replacement for it.

Sigh.. was it really necessary to start another thread about this? 





More information about the Digitalmars-d mailing list