Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There is some confusion, since <code>static</code> in C can mean two different things. One is static storage duration, and the other is internal linkage. <code>static</code> used as a keyword on file-scope will give the function or object it is used with internal linkage. </p> <p>Internal linkage for a function or object means that if you declare another function in another "file" (this is not really called "file", but rather translation unit - TU), then that declaration will refer to <em>a different</em> function: The name declared in that unit will "link" to a different entity than the name declared in that other translation unit, which was "internal" to that TU. The same applies to objects. </p> <p>Whether or not a file-scope variable is declared with <code>static</code>, it will still have a static storage duration: That means it lives through the whole program, and dies when the program terminates. Another example of an object that has static storage duration is a string literal. Where objects that have static storage duration are stored isn't specified, but they are usually stored depending on whether they are initialized or not: Initialized file-scope variables are usually stored in a section called ".data", while non-initialized file-scope variables are usually stored in a section called ".bss". Remember that if the variable isn't initialized, it will be zero initialized at the start of the program: The ".bss" section is usually zero initialized by an implementation on program's startup. </p> <p>I said "usually" everywhere, since where things are stored isn't specified. For example, some implementations could store string literals in a read-only section. And if you have a file-scope pointer and don't initialize it, the implementation initializes it to a null-pointer, which is not necessarily an object with all null bytes :)</p>
    singulars
    1. This table or related slice is empty.
    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.
    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