涉及restrict关键字的编译器错误

时间:2013-01-13 20:12:01

标签: c++ restrict restrict-qualifier

  

可能重复:
  What does the restrict keyword mean in C++?

我正在尝试在OS X 10.8.2上安装QMCPACK,我遇到了很多这样的错误:

bspline_base.h:95:17: error: expected ';' at end of declaration list
void *restrict coefs;
              ^
              ;

我不熟悉restrict关键字,但我觉得这可能是其他类型的问题,因为这是一个为其他人编译的流行代码。

以下是该代码的完整上下文:

typedef struct
{
  spline_code sp_code;
  type_code   t_code;
  void *restrict coefs;
} Bspline;

2 个答案:

答案 0 :(得分:2)

restrict不是标准 C ++ 中的关键字。代码只能在支持restrict扩展名的编译器中编译。

restrict C99 中的关键字。因此,如果您使用 C99 编译器,它将正常工作。

答案 1 :(得分:0)

restrict仅在C模式下可用。 clang++需要__restrict - 将-Drestrict=__restrict添加到编译器标记。

相关问题