Page 1 of 1

c99 _Pragma operator in OpenMP

Posted: Thu Jan 28, 2010 8:01 am
by PGK
Hi all,

Is the C99 _Pragma supported by OpenMP? The more common #pragma is first discussed on Page #21:
In C/C++, OpenMP directives are specified by using the #pragma mechanism provided by the C and C++ standards.
Which could imply that a compliant OpenMP c99 compiler would translate something like:

Code: Select all

_Pragma("omp parallel for")

Code: Select all

#pragma omp parallel for
and so be compliant.

As well as being an operator, it can appear as a result of macro expansion; e.g.

Code: Select all

#define PARFOR _Pragma("omp parallel for")
In any case, I only have gcc, which does appear to support the use of _Pragma like this for OpenMP. Is this well supported? Do other C99 compilers also support _Pragma?


Re: c99 _Pragma operator in OpenMP

Posted: Tue Feb 02, 2010 7:01 am
by Federico
TO my understanding, independently of OpenMP, a C99 compiler must support both forms, the #pragma directive and the _Pragma unary operator. Thus, it seems to be a matter of C99 compliance of each compiler. You should check with compiler vendor or developer organization. Documentation is available online for most compilers.