DIP60: @nogc attribute

Brad Anderson via Digitalmars-d digitalmars-d at puremagic.com
Thu Apr 17 23:50:47 PDT 2014


On Friday, 18 April 2014 at 06:35:33 UTC, Walter Bright wrote:
> On 4/17/2014 9:23 PM, Brad Anderson wrote:
>> Would @nogc apply to code being evaluated at compile-time? I
>> don't think it should.
>
> Yes, it would be. Compile time functions are not special, in 
> fact, there is no such thing in D.

But surely something like:

struct S
{
      this(int d) { data = d; }
      S opBinary(string op)(S rhs) @nogc
      {
        return S(mixin("data "~op~" rhs.data"));
      }

      private int data;
}

Would still work, right? There is no GC activity there.


More information about the Digitalmars-d mailing list