IBM extension

Type attributes

Type attributes are language extensions. These language features allow you to use named attributes to specify special properties of data objects. Type attributes apply to the definitions of user-defined types, such as structures, unions, enumerations, classes, and typedef definitions. Any variables that are declared as having that type will have the attribute applied to them.

A type attribute is specified with the keyword __attribute__ followed by the attribute name and any additional arguments the attribute name requires. Although there are variations, the syntax of a type attribute is of the general form:

Read syntax diagramSkip visual syntax diagramType attribute syntax --; aggregate types
 
>>-+-struct-+--__attribute__------------------------------------>
   +-union--+
   +-enum---+
   '-class--'
 
>--((--+----------------------------------------+--))----------->
       | .-,----------------------------------. |
       | V                                    | |
       '---attribute name--__attribute name__-+-'
 
>--+----------------+--{--member_definition_list--}--;---------><
   '-tag_identifier-'
 

Read syntax diagramSkip visual syntax diagramType attribute syntax --; typedef declarations
 
>>-typedef--type_declaration--type_name------------------------->
 
>--__attribute__--((--+----------------------------------------+--))--;-><
                      | .-,----------------------------------. |
                      | V                                    | |
                      '---attribute name--__attribute name__-+-'
 

The attribute name can be specified with or without double underscore characters leading and trailing; however, using the double underscore reduces the likelihood of a name conflict with a macro of the same name. For unsupported attribute names, the compiler issues diagnostics and ignores the attribute specification. Multiple attribute names can be specified in the same attribute specification.

The following type attributes are supported:

Related information



[ Top of Page | Previous Page | Next Page | Contents | Index ]