Search code examples
attributesddmdgdc

Is @nogc attribute implemented in d?


I made a little program in D that computes Fibonacci's numbers. It was supposed to be the most efficient possible, as I did this to compare D's speed of execution to that of other languages. Then I read about the @nogc attribute at dlang.org (here : http://dlang.org/attribute#nogc) and tried to use it like this :

@nogc
@safe
uint fibonacci(uint index)
{
    if(index < 2)
        return index;

    return fibonacci(index - 2) + fibonacci(index - 1);
}

I tried with DMD 2.065 and GDC 4.8.2 but both tell me : Error: undefined identifier nogc

Am I doing something wrong ? Is @nogc just not implemented for now ?


Solution

  • @nogc is a new attribute and is first implemented in DMD 2.066.