Reputation: 131
I'm trying to compile the attached C code with
gcc -Wall -o nesta.o nesta.c
but I'm getting the following error:
nesta.c: At top level: nesta.c:1004:15: error: expected identifier or ‘(’ before ‘double’ void restrict(double *coarse, double *fine,int imaxc,int jmaxc,int imaxf,int jmaxf)
As a side note, this is an old C program that used to work back in 1997.
Upvotes: 0
Views: 800
Reputation: 754280
Your code appears to use a function name restrict
, judging from the error message.
C99 introduced that as a keyword.
You'll need to force C90 mode in your compiler in the (very) short term; in the medium term, you'll need to rename the function so it doesn't match a keyword.
This is why the standards committee are reluctant to add keywords; they break existing working code (but at least it is a noisy breakage). It's not unreasonable that the code worked in 1997, before the C99 standard was finalized — it's likewise not unreasonable that it no longer compiles; restrict
has been part of the standard for nearly 20 years now.
Upvotes: 1