|
Static elements from C
In both C and C++ the keyword
static has two basic meanings, which unfortunately often step on each
other’s
toes:
- Allocated once at a fixed
address; that is, the object is created in a special static data area
rather than on the stack each time a function is called. This is the concept of
static storage.
- Local to a
particular translation unit (and local to a class scope in C++, as you will see
later). Here, static controls the visibility of a name, so that
name cannot be seen outside the translation unit or class. This also describes
the concept of linkage, which determines what names the linker will
see.
This section will look at
the above meanings of static as they were inherited from
C.
|
|