Hi,
I want to write a cross-plattform wrapper for some OS specific (Linux/MacOSX/Windows) calls to get the number of cores of the CPU etc. My idea was to put all of them in single functions with static variables, so stuff like the number of cores that does not change will be processed only once.
int getNumCPUCores()
{
static int numCores = 0;
if(!numCores)
{
// The info is aquired here
}
return numCores;
}
Now I wonder if this might be a bad idea, since all these static variables use up memory space whether they are initialized or not. Or did I misunderstand something?