Structure line not displayed correctly in MS Visual Studio Quick-Watch window

I have a structure definition that looks like this:

struct mystruct
    int first;
    int second;


I recently updated it to add new members:

struct mystruct
    int first;
    int additional1;
    int additional2;
    int second;


I am debugging a code that looks like this:

mystruct object;
object.second = 128;
printf("%d\n", object.second);


After executing the code, I look object.second

in the Quick-Watch window and see 0; however the code outputs 128

. When I look object

, I only see the members first

and second

it is as if the Quick-Watch window was still using my old structure declaration.

Also, the address object.second

if I print it from the code is different from what I see in the Quick-Watch window if I enter &object.second

there (off by a few words, my structure actually contains dozens of members, which I omitted for brevity) ...

I tried to fix these incompatibilities by recompiling, rebooting, reverting to a recent change (I am using source control) and reversing it. What else can I fix this problem?

I am using MS Visual Studio 2005. My code is actually C ++, but this part belongs to the usual C / C ++ subset.


source to share

1 answer

When you write mystruct object;

it works in Visual Studio 2005, but the correct way to write it, when you are using a regular structure declaration, rather than using a typedef, should be struct mystruct object;

as described.

I'm not sure if this is what was bothering you, but try it.



All Articles