Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
'var' : variable in 'private' clause cannot be a reduction variable in enclosing context
Remarks
Variables that appear in the reduction clause of a parallel directive cannot be specified in a private clause on a work-sharing directive that binds to the parallel construct.
Example
The following example generates C3038:
// C3038.cpp
// compile with: /openmp /c
int g_i, g_i2;
int main() {
   int i;
   #pragma omp parallel reduction(+: g_i)
   {
      #pragma omp for private(g_i)   // C3038
      // try the following line instead
      // #pragma omp for private(g_i2)
      for (i = 0; i < 10; ++i)
         g_i += i;
   }
}