Changes between Version 49 and Version 50 of ResumedC


Ignore:
Timestamp:
Oct 21, 2009, 4:37:47 PM (15 years ago)
Author:
Thanatermesis
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ResumedC

    v49 v50  
    5656You can use ''static'' inside a function or outside it, it has two different meanings:
    5757 * Inside a function: You can ''pre'' set a value to a variable ''(static int foo = 5)'', then the first time you enter on the function it will be set to 5, but the next times it not set again, it just remember the last value used
    58  * Outside a function (global mode): You will use it only in the actual file (compilation unit), good for optimization but you can't use it on other files
     58 * Outside a function (global mode): You can only use your static named element on this file, use always static for your functions and variables except when you really need to call it from another file of your source code, the meant of this is to prevent duplicated elements and to have a better optimization.
    5959
    6060Also, you can use the static variable (out of any function) in order to avoid a double-declaration of the same variable, when you use static (globally) it is limited to the file so, in another file is a different variable without any relation.