|
From: Per W. <pw...@ia...> - 2005-03-01 17:28:53
|
You have mixed up different uses of the static keyword. A static function is a function that is local to a source file, i.e. the name of the function isn't exported to the linker for reference from another source file. This allows multiple source files to implement different functions that all make use of the same name without any name collision. A static variable, declared outside of any function, is a variable that isn't exported to the linker, similar to a static function. Your quote is about static variables declared inside a function, in which case the variable keeps it's value between multiple calls of the function. /Per W On Fri, 25 Feb 2005, Alfred P. Reaud wrote: > >From C/C++ Reference > "The static data type modifier is used to create permanent storage for > variables. Static variables keep their value between function calls. > When used in a class, all instantiations of that class share one copy of > the variable." > > Farzan Hajian <far...@ho...> wrote: > > What is a static function? For example what is the difference > > between the following function and its non-static version?? |