auto storage class - infer or RAII?
Tomas Lindquist Olsen
tomas at famolsen.dk
Mon Nov 13 09:19:01 PST 2006
Bill Baxter wrote:
> 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
I think you are right. Hadn't thought of this.
More information about the Digitalmars-d
mailing list