#pragma omp declare reduction
Posted: Wed Feb 20, 2013 10:22 am
In 2.12 the draft says:
"The visibility and accessibility of this declaration are the same as those of a variable declared at the same point in the program."
Does that imply #pragma omp declare reduction is for C++ only allowed in namespace or block scope, not at class scope (because at class scope you wouldn't declare a variable, but data member or static data member)?
Also, perhaps:
"A user-defined reduction may not be re-declared in the current scope."
should be worded better, from this it isn't clear if
#pragma omp declare reduction(foo : char, int : omp_out += omp_in)
#pragma omp declare reduction(foo : short, long : omp_out += omp_in)
is ok or not. If the standard means that the same reduction-idenfifier can be re-declared for different types, but can't be re-declared for the same type, then it should probably make it more clear. I guess
typedef char char2;
typedef int int2;
#pragma omp declare reduction(foo : char, int : omp_out += omp_in)
#pragma omp declare reduction(foo : char2, int2 : omp_out += omp_in)
is meant to be invalid, so the same type would probably mean not just identical types, but compatible types according to language rules.
"The visibility and accessibility of this declaration are the same as those of a variable declared at the same point in the program."
Does that imply #pragma omp declare reduction is for C++ only allowed in namespace or block scope, not at class scope (because at class scope you wouldn't declare a variable, but data member or static data member)?
Also, perhaps:
"A user-defined reduction may not be re-declared in the current scope."
should be worded better, from this it isn't clear if
#pragma omp declare reduction(foo : char, int : omp_out += omp_in)
#pragma omp declare reduction(foo : short, long : omp_out += omp_in)
is ok or not. If the standard means that the same reduction-idenfifier can be re-declared for different types, but can't be re-declared for the same type, then it should probably make it more clear. I guess
typedef char char2;
typedef int int2;
#pragma omp declare reduction(foo : char, int : omp_out += omp_in)
#pragma omp declare reduction(foo : char2, int2 : omp_out += omp_in)
is meant to be invalid, so the same type would probably mean not just identical types, but compatible types according to language rules.