What is the default storage category for a global variable?
While searching on the web I found, some sites say that it is stable . But, steady means is internal relationship and variables can not be available outside the file scope. It should not be available for other object files. But, they can still be accessed by other files through announcements such as extern int i . And, if I explicitly specify stable in the global variable, the file is not available outside the scope.
Then, what is the right default storage class for global variables?
The default storage period is constant, but the default linking is externally you only confuse it a bit is not. (Always a good reference):
"You will find both complex and confusing interactions between these different elements: That's because they are!"
In the section with that quote, there is a useful table (8.1). The last line tells the case which you are interested in. As it notes, data objects with no storage class specification have no external relation and static duration.
Comments
Post a Comment