Community
cancel
Showing results for 
Search instead for 
Did you mean: 
dehvidc1
Beginner
110 Views

Problem with restrict in C++ code

Jump to solution
I had some C++ code using restrict that was compiling and running OK on MS7 using a 11.x version of ICC.

restrict double *vecArray = (double *) vec.data();

When I try to compile this code on ICC version 12.0.0 on Linux I get an error message:

error: "restrict" is not allowed

I'm using the -restrict compile flag.

Within the relevant code block the restrict statement is semantically accurate. I had it in there to tell the compiler not to worry about any aliasing ie more aggressive optimisation if possible.

Am I getting the error due to a more restrictive analysis on the part of the newer compiler version of where restrict is allowed?

Thanks

David
0 Kudos
1 Solution
TimP
Black Belt
110 Views
The usual use of restrict to promote optimization would look like
double * restrict vecArray
i.e. restrict makes sense (to me) only in definition of a pointer.
It is true that the newer compilers are stricter on syntax analysis.

View solution in original post

1 Reply
TimP
Black Belt
111 Views
The usual use of restrict to promote optimization would look like
double * restrict vecArray
i.e. restrict makes sense (to me) only in definition of a pointer.
It is true that the newer compilers are stricter on syntax analysis.

View solution in original post

Reply