Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><code>static</code> means many things in C / C++ / Objective-C. </p> <p>Objective-C follows C closely. In C++, <code>static</code> means more things than in C / Objective-C. So, don't judge what <code>static</code> does in Obj-C by what Bjarne Stroustrup says (who is the inventor of C++).</p> <p>In C and Objective-C, two main meanings of <code>static</code> are</p> <ol> <li><p>For a variable / function in the file level, it makes a variable / function invisible from other translation units (i.e. other source files compiled into the same program.) It doesn't mean its constant. </p></li> <li><p>For a variable declared inside a function, it makes a variable not to reside in a stack but in a more persistent location, as explained by no one in particular.</p></li> </ol> <p>In C++, in addition to this meaning, a <code>static</code> member in a class means it belongs to the class, not to an instance. This meaning is completely unrelated to the other meaning; in the olden days, people didn't want to introduce more reserved words in the language, so they just abused the same reserved words in different contexts to mean completely unrelated things. Another notorious example is the usage of the word <code>virtual</code>.</p> <p>In any case, <code>static</code> doesn't mean it's constant. </p> <p>Anyway, in a programming language, a thing means whatever the implementers or the standard committee members decide it to mean. Therefore I find it always helpful to read the <a href="http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1256.pdf" rel="nofollow">standard</a>. Just look for the word <code>static</code> in that PDF. You'll learn everything about <code>static</code> keyword in the programming language C there.</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. 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