Original Post
🔒 Locked
small question
Advertisement
Static fuctions are only used in classes (I may be wrong). You can not declare a static function outside of a class (I tried). The main difference between a static function and a nonstatic function is that the static function lacks a this pointer (but that doesn't keep you from passing one in). Static functions only have access other members of the class it belongs to.
By the way, the functions you gave are missing a return type. [smile]
By the way, the functions you gave are missing a return type. [smile]
Funnily enough, the example the OP gave is nearly a non-example, because inlined functions are not compiled independently and are therefore not found in the symbol table for the object file anyway. Of course, many compilers will provide a compiled version for debug mode so that the debugger can step through the inlined function, but this is not required.
inline static foo bar();
would be equivalent to
inline foo bar();
but
static foo bar();
is not exported to the symbol table, whereas
foo bar();
is.
Of course, the behaviour of the static keyword inside a class declaration is totally different, thankyou Bjarne!
inline static foo bar();
would be equivalent to
inline foo bar();
but
static foo bar();
is not exported to the symbol table, whereas
foo bar();
is.
Of course, the behaviour of the static keyword inside a class declaration is totally different, thankyou Bjarne!
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement