Som*_*der 4 attributes d dmd gdc
我在D中制作了一个计算Fibonacci数字的程序.它应该是最有效的,因为我这样做是为了比较D的执行速度和其他语言的执行速度.然后我在dlang.org上阅读了@nogc属性(这里:http://dlang.org/attribute#nogc ),并试着像这样使用它:
@nogc
@safe
uint fibonacci(uint index)
{
if(index < 2)
return index;
return fibonacci(index - 2) + fibonacci(index - 1);
}
Run Code Online (Sandbox Code Playgroud)
我试过DMD 2.065和GDC 4.8.2,但两个都告诉我: Error: undefined identifier nogc
难道我做错了什么 ?@nogc暂时没有实现吗?
小智 7
@nogc 是一个新属性,首先在DMD 2.066中实现.
| 归档时间: |
|
| 查看次数: |
459 次 |
| 最近记录: |