attributes - @nogc 属性是否在 d 中实现?

标签 attributes d dmd gdc

我用 D 编写了一个计算斐波那契数的小程序。它应该是最高效的,因为我这样做是为了将 D 的执行速度与其他语言的执行速度进行比较。然后我在 dlang.org(这里:http://dlang.org/attribute#nogc)上阅读了@nogc 属性,并尝试像这样使用它:

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

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

我尝试使用 DMD 2.065 和 GDC 4.8.2,但都告诉我:Error: undefined identifier nogc
难道我做错了什么 ? @nogc 暂时没有实现吗?

最佳答案

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

关于attributes - @nogc 属性是否在 d 中实现?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24938330/

相关文章:

arrays - 如何获取 D 中数组元素的引用?

d - 如何将 ref/out 函数指针传递给函数?

gwt - smartgwt setAttribute 命令不起作用

memory-leaks - 禁用D的GC是 'ok'吗?

c# - 在 C# 中实现接口(interface)和应用属性之间的区别

d - D 中是否有 EXIT_SUCCESS 和 EXIT_FAILURE 的类似物

osx-snow-leopard - DMD 2 雪豹

d - 从 D 中的 char[] 数组中删除空白字符

ruby - Ruby 模型的数组属性

java - 我应该始终在 Java 类中使用 getter/setter 方法,还是有时可以使用公共(public)属性?