Question about @nogc
John Colvin via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue May 20 10:14:28 PDT 2014
On Tuesday, 20 May 2014 at 12:25:11 UTC, Dominikus Dittes Scherkl
wrote:
> 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?
Yes, that should be allowed.
More information about the Digitalmars-d-learn
mailing list