Please look at this code:
class A
{
int a;
};
Then add one more member to class A:
class A
{
int a;
int b;
};
开发者_Python百科
In my huge solution when I add one more member to a class (like member b in class A) I get stack overflow error. I assume that this is somehow related to writing to not reserved data adresses.
Is there any way to find such places in visual studio? Any better ideas why such kind of error happens?
Well, first question: Are you really adding an int
? If yes, then this answer is applicable.
This can happen when:
- Your class is so enormous that it's constructor will cause a stack overflow because it can not allocate enough memory on the stack to allocate memory for all members.
- You are doing pointer arithmic somewhere that fails when you add a member.
- You are creating an huge array on the stack of this object that becomes too large when you add this member.
I would suggest you supply us with some more relevant information (platform, compiler, real code/class definition) first.
精彩评论