Destructor semantics

Steven Schveighoffer schveiguy at yahoo.com
Wed Aug 11 06:06:29 PDT 2010


On Tue, 10 Aug 2010 20:28:32 -0400, bearophile <bearophileHUGS at lycos.com>  
wrote:

> Jonathan M Davis:
>> If attempts to use any reference types in destructors were a  
>> compile-time error
>> with a clear error message, that could go a long way in stopping people  
>> from
>> trying to misuse destructors.
>
> This sounds like a positive idea, maybe fit for an enhancement request.

No, reference types are not necessarily heap allocated.  Guys, the  
distinction is heap vs. manual, not reference vs. value.  Value types can  
be on the heap, and references can refer to non-heap data.

Adding artificial restrictions that force casting are not going to help at  
all.

-Steve


More information about the Digitalmars-d mailing list