DIP60: @nogc attribute
Steven Schveighoffer via Digitalmars-d
digitalmars-d at puremagic.com
Fri Apr 25 21:49:09 PDT 2014
On Fri, 25 Apr 2014 20:50:46 -0400, Ola Fosheim Grøstad
<ola.fosheim.grostad+dlang at gmail.com> wrote:
> On Friday, 25 April 2014 at 15:32:40 UTC, Steven Schveighoffer wrote:
>>
>> You know what, in fact, @nogc may need to be re-branded as
>> compiler-specific.
>
> You should have a compiler switch that let's you get "compiler-optimal
> non-portable @nogc".
I feel like I'm being a nag, but it sure seems to me like having something
like that is no different than custom behavior of @nogc. Basically, I have
a file blah.d, which can only be compiled with X, even if it's only with
the option X -extraNogcFunctionality
In other words, I have this function. It can avoid GC allocations if the
compiler can do extra steps to prove it. But not all compilers go to these
lengths.
So if I only care about compiling with savvy enough compilers, why do I
need to use some special compiler-specific escape? I think the attribute
is fine being defined as "if you can't do this without calling the GC,
refuse to compile," and the compiler may or may not compile it.
In any case, I don't need another explanation, I don't think it will ever
make sense to me.
-Steve
More information about the Digitalmars-d
mailing list