omp critical name namespace

Comments and discussion of the 4.1 OpenMP Draft specifications. Comment period ends September 30, 2015. See http://openmp.org/wp/openmp-specifications/ to download the specifications. (Read Only)
Forum rules
The OpenMP Forums are now closed to new posts. Please visit Stack Overflow if you are in need of help: https://stackoverflow.com/questions/tagged/openmp
Locked
fewl9012
Posts: 73
Joined: Mon Jul 27, 2015 4:50 pm

omp critical name namespace

Post by fewl9012 »

P147:4ff
C/C++: Identifiers used to identify a critical construct have external linkage and are in a name space that is separate from the name spaces used by labels, tags, members and ordinary identifiers.

Fortran: The names of critical constructs are global entities of the program. If a name conflicts with any other entity, the behavior of the program is unspecified.

For C/C++, it implies that '#pragma omp critical foo' creates an external thing named 'foo' that would not conflict with any label 'foo:', or a struct member 'a.foo', or a variable 'int foo', but I'm not sure whether 'ordinary identifiers' also includes external function names and external variable names.

For Fortran, it implies that '!$omp critical foo' creates a global entity named 'foo' that does conflict with a variable 'integer::foo' or a subroutine foo or any other thing named foo.

Creating a new global namespace for critical names is something not to be taken lightly, however here it's clear that it's probably necessary. This allows and requires the programmer to manage a global namespace, which means it's dangerous to use in libraries, since you don't know if you might conflict with the same name in some other library.

However, the C verbage is more clear that the critical names are distinct from (most) other names, whereas the Fortran verbage is more clear that the critical names are NOT distinct from other names. Which is it to be?

Is it undefined, unspecified, or implementation-defined whether a C/C++ #pragma omp critical foo and a Fortran !$omp critical foo will be treated as having the same name? Case is significant in C/C++, not in Fortran.

Locked