forcing "@nogc" on class destructors

Paolo Invernizzi via Digitalmars-d digitalmars-d at puremagic.com
Wed Jan 21 15:03:09 PST 2015


On Wednesday, 21 January 2015 at 20:32:14 UTC, Steven 
Schveighoffer wrote:
> On 1/21/15 3:37 AM, Paolo Invernizzi wrote:
>> On Wednesday, 21 January 2015 at 03:02:53 UTC, Steven 
>> Schveighoffer wrote:
>>> On 1/20/15 9:04 PM, ketmar via Digitalmars-d wrote:
>>> If he does it wrong, it gives him a stack trace on where to 
>>> look. What
>>> is different here than any other programming error?
>>
>> Are you suggesting that newcomers should learn D by 
>> discovering it day
>> by day from stack traces?
>
> No, I was saying if something causes an exception/error, it is 
> a programming error, and there just isn't any way for a 
> compiler to prevent people from making *any* mistakes.
>
> But calling sometimes-allocating functions inside a dtor that 
> don't allocate when you call them *that* time shouldn't be 
> banned by the compiler.

You can't ban them, either now with an annotated @nogc 
destructor: SetFunctionAttributes.




More information about the Digitalmars-d mailing list