The weak Variable Attribute

Linux The variable attribute weak and the function attribute weak have the same behavior and rationale. The syntax for applying an attribute specifier to a variable declaration allows the variable attribute specifier to appear either before or after the declarator. The following diagrams show the two forms of valid declaration syntax.

>>-type_specifier--__attribute__-------------------------------->
 
>--((--+-weak-----+--))--variable_name-------------------------><
       '-__weak__-'
 
 

The above syntax is the same as that for declaring and defining a function weak. The other valid syntax for declaring a weak variable is the same as that for a weak function declaration, but not the function definition.

>>-type_specifier--variable_name--__attribute__----------------->
 
>--((--+-weak-----+--))----------------------------------------><
       '-__weak__-'
 
 

Related References

IBM Copyright 2003