2013-01-13 61 views
0

可能重複:
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; 
+0

關於限制,請參閱http://stackoverflow.com/questions/776283/what-does-the-restrict-keyword-mean-in-c。正如第一個答案指出的那樣,它不是C++語言的關鍵字(您標記的)。 –

回答

2

restrict不在標準C++一個關鍵字。該代碼只能在支持restrict擴展的編譯器中編譯。

restrictC99一個關鍵字。所以如果你使用編譯器,它會工作正常。

0

restrict僅在C模式下可用。 clang++將需要__restrict - 將-Drestrict=__restrict添加到編譯器標誌。