I posted this to the gcc-help mailing list, but got no reply there. So here are the questions:

First question:

Is it possible to use the __restrict__ qualifier on a member
variable, like in the example below?

class array {
    double * __restrict__ data;
...
...
};

The compiler gives no error message, but does declaring 'data' as
a __restrict__ed pointer have any effect on functions that accept
references to 'array's as arguments?

The gcc documentation only mentions using __restrict__ on function
arguments or member functions, [1] and in that case only that single function is affected which has the declaration.

Second question:

If this does not work, how can I achieve the same effect as with

void fun(double * __restrict__ arr1, double * __restrict__ arr2)
{ ... }

if I use array & instead of double *? (The problem is that the class 'array' does not contain the actual data, just a pointer to it.)

[1] http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Restricted-Pointers.html#index-restricted-pointers-2455
_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to