windows - Visual C++ 2008 variables overlap in memory -


i've got strange problem. i've got program i'm using static variables (some of objects including other variables) , of them seem overlap in memory in _debug_ mode. program rather complex , i've not yet had time reproduce in smaller use case. looks this:

struct bar   {     int i; ...  };  class  {  public:  bar b; ...  };  class b {  public:  static foo f; ...   static a; }; 

i set break point @ _tmaincrtstartup in order see happens _before_ of code ran. once break point hit, i'm looking @ variables , addresses in watch window , see following picture:

&b::f - 0x00fa68e0  &(b::a.b) - 0x00fa68cc   sizeof(b::a.b) - 28 

but (0x00fa68e0 - 0x00fa68cc) = 20

so, these variables overlap in memory (if change "i", object affected). started looking @ map file b::a defined @ 0x00fa6340.

so linker or compiler bug? no code has ran yet, yet there memory overlap here.

have come across in vs 2008?

is known bug, there workaround or missing in code?


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -