[basic.stc.static] # 6 Basics [[basic]](./#basic) ## 6.8 Memory and objects [[basic.memobj]](basic.memobj#basic.stc.static) ### 6.8.6 Storage duration [[basic.stc]](basic.stc#static) #### 6.8.6.2 Static storage duration [basic.stc.static] [1](#1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/basic.tex#L4285) All variables which - [(1.1)](#1.1) do not have thread storage duration and - [(1.2)](#1.2) belong to a namespace scope ([[basic.scope.namespace]](basic.scope.namespace "6.4.6 Namespace scope")) or are first declared with the static or extern keywords ([[dcl.stc]](dcl.stc "9.2.2 Storage class specifiers")) have [*static storage duration*](#def:storage_duration,static "6.8.6.2 Static storage duration [basic.stc.static]")[.](#1.sentence-1) The storage for these entities lasts for the duration of the program ([[basic.start.static]](basic.start.static "6.10.3.2 Static initialization"), [[basic.start.term]](basic.start.term "6.10.3.4 Termination"))[.](#1.sentence-2) [2](#2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/basic.tex#L4299) 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]](class.copy.elision "11.9.6 Copy/move elision")[.](#2.sentence-1) [3](#3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/basic.tex#L4305) [*Note [1](#note-1)*: The keyword static can be used to declare a block variable ([[basic.scope.block]](basic.scope.block "6.4.3 Block scope")) with static storage duration;[[stmt.dcl]](stmt.dcl "8.10 Declaration statement") and [[basic.start.term]](basic.start.term "6.10.3.4 Termination") describe the initialization and destruction of such variables[.](#3.sentence-1) The keyword static applied to a class data member in a class definition gives the data member static storage duration ([[class.static.data]](class.static.data "11.4.9.3 Static data members"))[.](#3.sentence-2) — *end note*]