Variable attributes (IBM extension)
A variable
attribute is a language extension that allows you to use a named attribute
to specify special properties of variables. Currently, only the variable
attribute aligned is supported on the z/OS® platform.
A variable attribute is
specified with the keyword __attribute__ followed
by the attribute name and any additional arguments the attribute name
requires. A variable __attribute__ specification
is included in the declaration of a variable, and can be placed before
or after the declarator. Although there are variations, the syntax
generally takes either of the following forms:
Variable attribute syntax: post-declarator
Variable attribute syntax: pre-declarator
You can specify attribute name with or without leading and trailing double underscore characters; however, using the double underscore characters reduces the likelihood of name conflicts with macros of the same name. For unsupported attribute names, the z/OS XL C/C++ compiler issues diagnostics and ignores the attribute specification. Multiple attribute names can be specified in the same attribute specification.
struct A {
int b __attribute__((aligned)); /* typical placement of variable */
/* attribute */
int __attribute__((aligned)) c; /* variable attribute can also be */
/* placed here */
int d, e, f __attribute__((aligned)); /* attribute applies to f only */
int g __attribute__((aligned)), h, i; /* attribute applies to g only */
int __attribute__((aligned)) j, k, l; /* attribute applies to j, k, and l */
};The following variable attributes are supported: