help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Using __restrict__ on a class member variable


From: SzH
Subject: Using __restrict__ on a class member variable
Date: Tue, 24 Apr 2007 21:53:10 +0200
User-agent: Thunderbird 2.0.0.0 (Windows/20070326)

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]