pointer aliasing and reference ?


I am coming from c language and I wish to learn c++ further.

I am used to the restrict keyword to hint the compiler that no overlap is going to happen in the values passed to the function.

void foo( int * restrict a, char * restrict b)

I understand that I can pass by reference in c++.

void foo( int &a, char &b)

Using it, will it automatically restrict it or not ? It is very important for performance reasons (no checks at each iterations/steps)

for gcc compiler you can use __restrict__

void foo(int *__restrict__ a, char *__restrict__ b)

source: https://gcc.gnu.org/onlinedocs/gcc/Restricted-Pointers.html

for the visual studio compiler according to their page its __restrict

void foo(int *__restrict a, char *__restrict b)

source: http://msdn.microsoft.com/en-us/library/5ft82fed.aspx
Topic archived. No new replies allowed.