Technical data
Cray Standard C/C++ Reference Manual
• A taskprivate variable cannot also be a soft external.
• The address of a taskprivate variable cannot be taken in a constant
expression (for example, an initializer).
3.8.9 taskshared Directive (Cray Standard C Compiler)
The taskshared directive ensures that specified variables are accessible to all
tasks (not stored as task private). For example, you can use this directive with the
-h taskprivate option, to exempt certain variables that would otherwise be
task private. The taskshared directive overrides the -h taskcommon and
-h taskcommon command line options.
The format of this directive is as follows (the comma-separated list of variables
can be placed in parentheses):
#pragma _CRI taskshared variable,...
The taskshared directive can appear in both global and local scopes and
applies only to the following types of variables:
• Global scope variables, in which case the directive must appear at global
scope.
• Local scope variables with static storage class, in which case the directive
must appear within the same scope as the variable declaration.
When a variable is designated as task shared, subsequent declarations of that
variable in the same source file inherit the task shared storage class.
The following example illustrates the use of the taskshared directive:
/* The #pragma directive below retains "test" in
shared storage when the -h taskprivate command line
option is used. */
int test;
#pragma _CRI taskshared test /* Keep "test" in taskshared */
3.8.10 taskcommon Directive
The taskcommon directive specifies the task common storage class for variables.
The format of this directive is as follows (the comma-separated list of variables
can be placed in parentheses):
76 S–2179–36










