Wednesday, February 27, 2008

extern usage

The extern keyword declares a variable or function and specifies that it has external linkage
(its name is visible from files other than the one in which it's defined). When modifying a variable, extern specifies that
the variable has static duration (it is allocated when the program begins and deallocated when the program ends).
The variable or function may be defined in another source file, or later in the same file.
Declarations of variables and functions at file scope are external by default.
In C++, when used with a string, extern specifies that the linkage conventions of another language are being used for the declarator(s).
C functions and data can be accessed only if they are previously declared as having C linkage. However, they must be defined in a
separately compiled translation unit.

No comments: