Copyright (C) 2000-2012 |
GNU Info (gcc-300.info)Restricted PointersRestricting Pointer Aliasing ============================ As with gcc, g++ understands the C99 feature of restricted pointers, specified with the `__restrict__', or `__restrict' type qualifier. Because you cannot compile C++ by specifying the `-std=c99' language flag, `restrict' is not a keyword in C++. In addition to allowing restricted pointers, you can specify restricted references, which indicate that the reference is not aliased in the local context. void fn (int *__restrict__ rptr, int &__restrict__ rref) { ... } In the body of `fn', RPTR points to an unaliased integer and RREF refers to a (different) unaliased integer. You may also specify whether a member function's THIS pointer is unaliased by using `__restrict__' as a member function qualifier. void T::fn () __restrict__ { ... } Within the body of `T::fn', THIS will have the effective definition `T *__restrict__ const this'. Notice that the interpretation of a `__restrict__' member function qualifier is different to that of `const' or `volatile' qualifier, in that it is applied to the pointer rather than the object. This is consistent with other compilers which implement restricted pointers. As with all outermost parameter qualifiers, `__restrict__' is ignored in function definition matching. This means you only need to specify `__restrict__' in a function definition, rather than in a function prototype as well. automatically generated by info2www version 1.2.2.9 |