[basic.stc.static] (original) (raw)
6 Basics [basic]
6.7 Memory and objects [basic.memobj]
6.7.5 Storage duration [basic.stc]
6.7.5.1 Static storage duration [basic.stc.static]
All variables which do not have dynamic storage duration, do not have thread storage duration, and are not local have static storage duration.
If a variable with static storage duration has initialization or a destructor with side effects, it shall not be eliminated even if it appears to be unused, except that a class object or its copy/move may be eliminated as specified in [class.copy.elision].
The keyword static can be used to declare a local variable with static storage duration.
[ Note
:
[stmt.dcl] describes the initialization of local static variables; [basic.start.term]describes the destruction of local static variables.
— end note
]
The keyword static applied to a class data member in a class definition gives the data member static storage duration.