Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><code>static</code> when applied to a local variable gives that variable <em>static storage duration</em>. This means that the <code>justAbool</code>'s lifetime lasts to the end of the program rather than to the end of the invocation of the function. It's scope stays the same, it can only be accessed by name in the function, after the declaration appears.</p> <p><code>justAbool</code> will be initialized (using the supplied initializer <code>= false</code>) the first time that the function is called. Thereafter it will retain its previous value, it will not be reinitialized when the function is called again.</p> <p>Here are some fuller details about storage duration and lifetimes, with references to the standard.</p> <p>If an object has <em>static storage duration</em>, it means that the storage for the object lasts for the duration of the program (beginning to end). (3.7.1 [basic.stc.static])</p> <p>As a <code>bool</code> is a type without a non-trivial constructor, its lifetime mirrors that of its storage, i.e. it lives from the beginning to the end of the program. (3.8 [basic.life])</p> <p>All objects with <em>static storage duration</em> (including local objects) are zero-initialized before any other initialization. (6.7/4 [stmt.decl]) [For local objects with an initializer this is fairly academic because there is no way to read their value before their declaration is reached.]</p> <p>Local objects of POD type with <em>static storage duration</em> initialized with <em>constant-expressions</em> are initialized before their block is entered, otherwise local objects with <em>static storage duration</em> are initialized when control passes through their declaration. (6.7/4 again)</p> <p>An implementation is permitter, but not required, to perform early initialization in some situations.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload