title: OpenMP named critical section: if a program variable is used, is it evaluated or is it used as string without being evaluated?
body: <p>I have the following piece of code which I want to add omp for to:</p>
  
  <pre class="lang-c prettyprint-override"><code>for ( int i = 0 ; i &lt; N ; i++ ) {
      double max2 = 0.; 
      (calculate max2);
  
      for ( int j = 0 ; j &lt; 3 ; j++) {
          int m = group[i].member[j];
          if ( members[m].norm &lt; max2 ) {
              members[m].norm = max2; 
          }
      }
  }
  
  </code></pre>
  
  <p>The access to members needs to be protected but I would like to use a named critical section so as to avoid the speed penalty of effectively serializing that loop. What I want to do is this:</p>
  
  <pre class="lang-c prettyprint-override"><code>#pragma omp parallel for
  for ( int i = 0 ; i &lt; N ; i++ ) {
      double max2 = 0.; 
      (calculate max2);
  
      for ( int j = 0 ; j &lt; 3 ; j++) {
          int m = group[i].member[j];
  #pragma omp critical (m)
          if ( members[m].norm &lt; max2 ) {
              members[m].norm = max2; 
          }
      }
  }
  
  </code></pre>
  
  <p>so that only threads actually writing to the same m value wait for each other. My question is: is "m" used as a string for the critical name or is it actually evaluated and its value used as the name of the critical section? It does compile but I do not know if it does what I think it does. I would greatly appreciate if anyone can clarify what omp does here (eg how omp implements these).</p>
  
  <p>Thank you * very much.</p>