Using __restrict__ on a class member variable

S

SzH

I understand that __restrict__ is a gcc extension, and not in the
official standard, but I got no reply on the gcc-help mailing list.
Since more people are reading this newsgroup, there is a greater
probability that someone can offer his/her help here.

First question:

Is it possible to use the __restrict__ qualifier on a member
variables, like in the example below (with gcc)?

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 arrays as arguments?

The gcc documentation only mentions using __restrict__ on function
arguments or member functions. [1] In this case only the a single
function is affected.

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 *?

[1] http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Restricted-Pointers.html#index-restricted-pointers-2455
 
V

Victor Bazarov

SzH said:
I understand that __restrict__ is a gcc extension, and not in the
official standard, but I got no reply on the gcc-help mailing list.

Since it's not a standard modifier/qualifier, any discussion on it
would be off-topic here. Have you tried 'gnu.g++.help'?
Since more people are reading this newsgroup, there is a greater
probability that someone can offer his/her help here.

Yes, and most readers here are men. Would there be a greater
probability that someone can offer help on male hygene here?..
Whether there is or there isn't does not make questions on male
hygene on topic. :-/

V
 
S

SzH

Victor said:
Since it's not a standard modifier/qualifier, any discussion on it
would be off-topic here. Have you tried 'gnu.g++.help'?

I didn't know about gnu.g++.help before. I will post there.
Yes, and most readers here are men. Would there be a greater
probability that someone can offer help on male hygene here?..
Whether there is or there isn't does not make questions on male
hygene on topic. :-/

Don't be rude. My question was still much more closely related to
(standard) C++ than male hygiene. At least I learned about gnu.g++.help
now so it was not a completely bad idea to post here.
 
A

Andre Kostur

I understand that __restrict__ is a gcc extension, and not in the
official standard, but I got no reply on the gcc-help mailing list.
Since more people are reading this newsgroup, there is a greater
probability that someone can offer his/her help here.

Wrong. Far greater probability that someone on gcc-help will know. Even
worse that you _know_ that you're off-topic, and know a more appropriate
place to ask, yet to persisted on asking here.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top