A problem about g++ 4.8.5
shaoben zhu
zhushaoben@gmail.com
Thu Mar 28 09:34:48 GMT 2024
I compile my program using g++ 4.8.5, I find that when my program exits, it
first deconstructs the static member variables of class A, and then
deconstructs a global object of class A. This caused an error in my program.
Could you tell me how can I avoid this problem?Upgrade compiler
version?Modify my code?
my code like this:
class A{
static int var;
~A(); //A Destructor depended var
};
int A::var;
A obj;
var deconstructs before obj
More information about the Gcc
mailing list