F
Frederick Gotham
Let's say you want to write a simple header file, and don't want to be
burdened with having to provide a source file as well with it.
There's a problem when the need arises for a global object. You could simply
make the object static... but then you'll have a separate object for each
source file that includes the header.
Do many people use a inline function to get around this?
inline
int &GetGlobal()
{
static int i;
return i;
}
burdened with having to provide a source file as well with it.
There's a problem when the need arises for a global object. You could simply
make the object static... but then you'll have a separate object for each
source file that includes the header.
Do many people use a inline function to get around this?
inline
int &GetGlobal()
{
static int i;
return i;
}