Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does C++11 add the C99 restrict specifier? If not, why not?

Tags:

c++

c++11

c++-amp

restrict is a C99 feature which is getting a lot of attention lately by allowing the compiler to perform "previously-fortran-only" optimizations to pointers. It's also the same keyword announced by Microsoft recently to be the underpinnings of the C++AMP specification.

Is that keyword actually in the FCD? If not, is there a specific reason it was omitted?

like image 927
Billy ONeal Avatar asked Jun 22 '11 03:06

Billy ONeal


People also ask

What does restrict mean C?

In the C programming language, restrict is a keyword, introduced by the C99 standard, that can be used in pointer declarations. By adding this type qualifier, a programmer hints to the compiler that for the lifetime of the pointer, no other pointer will be used to access the object to which it points.

What is restrict type qualifier in C?

The restrict qualifier can be used in the declaration of a structure member. A compiler can assume, when an identifier is declared that provides a means of access to an object of that structure type, that the member provides the sole initial means of access to an object of the type specified in the member declaration.


1 Answers

The only mention of restrict in the C++11 FDIS is on §17.2 [library.c]:

The descriptions of many library functions rely on the C standard library for the signatures and semantics of those functions. In all such cases, any use of the restrict qualifier shall be omitted.

So restrict is not in C++11.

like image 56
R. Martinho Fernandes Avatar answered Oct 09 '22 23:10

R. Martinho Fernandes