简体   繁体   中英

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 ?

@nogc是一个新属性,首先在DMD @nogc中实现。

The first compiler that will support the brand new @nogc feature is the DMD v2.066. The stable release is not out yet, only few betas have been released by now (end of July 2014). Once DMD 2.066 is released, we can rightfully say that D supports it. Until that happens we can only say it is an experimental D feature.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM