Question about @nogc

Dominikus Dittes Scherkl via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue May 20 05:25:09 PDT 2014


Did I understand correct that a function can only be @nogc if 
also all functions that it calls are @nogc too (and of course it 
doesn't use the GC itself)?

If so, should this be possible:

string foo()
{
    // use GC to allocate some string
}

bar @nogc
{
    mixin(foo());
}

Because, bar() didn't really call foo() but instead foo() is 
evaluated during compile time and it's result is now part of the 
code, right?


More information about the Digitalmars-d-learn mailing list