Reputation: 4765
Is this
pointer always shared in OpenMP?
Compiler does not complain about following code, despite default(none)
:
#pragma omp parallel for default(none), shared(n)
for ( SInt i = 0; i < n; ++i )
{
f( i, this ); // f is some function.
}
Upvotes: 4
Views: 229
Reputation: 8042
The OpenMP standard defines data-sharing attribute rules for variables referenced in your code. Anyhow, according to the C++ standard draft (n3242 9.3.2) this
is not a variable but a prvalue expression (emphasis mine):
In the body of a non-static (9.3) member function, the keyword this is a prvalue expression whose value is the address of the object for which the function is called. The type of this in a member function of a class X is X*. If the member function is declared const, the type of this is const X*, if the member function is declared volatile, the type of this is volatile X*, and if the member function is declared const volatile, the type of this is const volatile X*.
Upvotes: 2