Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

Problem with restrict in C++ code

dehvidc1
Beginner
631 Views
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
Honored Contributor III
631 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

0 Kudos
1 Reply
TimP
Honored Contributor III
632 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.
0 Kudos
Reply