auto storage class - infer or RAII?
Bill Baxter
dnewsgroup at billbaxter.com
Sun Nov 12 20:32:38 PST 2006
Tomas Lindquist Olsen wrote:
> Walter Bright wrote:
> I'd like to see 'scoped' as a new storage class for classes and dynamic
> arrays. Using it for anything else should be an error. This would mean
> that 'auto class' would become 'scoped class' too.
I think
scoped int a = expr;
should be ok. Allowing that enables you to treat value types and classes
uniformly in some template usages.
{
scoped T a = make_temp_var();
...
}
// a has been cleaned up here, whether it was a class or not
I don't have a specific use case in mind, but it seems there's no reason
to not allow it, since a basic value type acts like it's scoped anyway.
--bb
More information about the Digitalmars-d
mailing list