there is something that’s bugging me.
In a non-threaded program, is it better to have local static variables(inside methods) or static class members?
In this example:
class C{
public:
C(){};
void foo();
};
void C::foo(){
static int bar = 0;
bar++;
printf("%d\n",bar);
}
Is it considered a bad practice if bar will solely be used in C::foo()?
Neither is better. They serve very different use cases