forcing "@nogc" on class destructors

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Thu Jan 22 03:58:16 PST 2015


On 1/21/15 3:45 AM, "Ola Fosheim =?UTF-8?B?R3LDuHN0YWQi?= 
<ola.fosheim.grostad+dlang at gmail.com>" wrote:
> On Wednesday, 21 January 2015 at 03:03:50 UTC, Steven Schveighoffer wrote:
>> It's neither spurious, nor a race condition.
>
> How can you say that a priori?

When the GC collects, it doesn't allow memory allocation. This is not a 
race condition, it's simply a fact of programming with D. It's not 
unintentional or spurious.

A race condition can LEAD to this being triggered, but the abort itself 
is not a race condition. And forcing a default of @nogc will not fix this.

You said "spurious race conditions in memory deallocation patterns that 
remain undetected and cause random crashes after deployment are ok"

If you didn't mean that we were *causing* spurious race conditions by 
allowing non- at nogc calls inside a destructor, and just meant that 
spurious race conditions were not ok, I agree with you.

-Steve


More information about the Digitalmars-d mailing list