Technical data
#pragma Directives [3]
3.4 Alternative Directive form: _Pragma
Compiler directives can also be specified in the following form, which has the
advantage in that it can appear inside macro definitions:
_Pragma("_CRI identifier");
This form has the same effect as using the #pragma form, except that everything
that appeared on the line following the #pragma must now appear inside the
double quotation marks and parentheses. The expression inside the parentheses
must be a single string literal, but it cannot be a macro that expands into a string
literal. _Pragma is an extension to the C and C++ standards.
The following is an example using the #pragma form:
#pragma _CRI ivdep
#pragma _CRI parallel private(i, j, k) \
shared(a, b, c) \
valude(x, y, z)
The following is the same example using the alternative form:
_Pragma("_CRI ivdep");
_Pragma("_CRI parallel private(i, j, k) \
shared(a, b, c) \
value(x, y, z)");
In the following example, the loop automatically vectorizes on UNICOS systems
wherever the macro is used:
#define SEARCH(A, B, KEY, SIZE, RES) \
{\
int i; \
_Pragma("_CRI ivdep"); \
for (i = 0; i < (SIZE); i++) \
if ( (A)[ (B)[i] ] == (KEY)) break; \
(RES)=i;
}
It is possible to use this feature in a portable, conformant C program. To do so,
you must select a name from the user name space (that is, any valid identifier
that does not begin with an underscore, for instance Pragma) and use that name
instead of _Pragma. Then insert preprocessor directives at the beginning of the
compilation unit, as in the following example:
S–2179–36 47










