FIX: Struct Data Member Incorrectly Displayed in Watch Window

Last reviewed: September 16, 1997
Article ID: Q106394
1.00 1.50 | 1.00 2.00
WINDOWS   | WINDOWS NT
kbtool kbfixlist kbfasttip

The information in this article applies to:

  • Microsoft CodeView Debugger for Windows, versions 4.0, 4.01, and 4.1
  • Microsoft CodeView Debugger for MS-DOS, versions 4.0, 4.01, and 4.1
  • Microsoft CodeView Debugger for Win32s, version 4.25
  • The Visual Workbench Integrated Debugger, included with:

        - Microsoft Visual C++ for Windows, versions 1.0 and 1.5
        - Microsoft Visual C++, 32-bit Edition, versions 1.0 and 2.0
    

SYMPTOMS

Setting a watch on a data member of a structure whose tag name is the same as the struct variable name produces an incorrect result.

This problem occurs with C++ programs in the Visual Workbench Debugger for Windows, CodeView for Windows, and CodeView for MS-DOS.

This problem occurs with C programs in the Visual Workbench Debugger for Windows NT and CodeView for Win32s.

RESOLUTION

The best solution is to not use the same name for the struct tag and the struct variable. Another option is to use the Locals window to display the data member.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed above. This problem was fixed in Microsoft Visual C++, 32-bit Edition, version 4.0.

MORE INFORMATION

To reproduce the problem in the Visual Workbench debugger, compile and link the following sample as a QuickWin program or place similar code in a Windows program. If you set a watch on test, it will expand correctly in the Watch window.

The incorrect expansion is:

   -test
      int a

The correct expansion is:

   -test = {...}
      a = 1;

Sample Code

/* Compiler Options needed: /Od /Zi
*/

void main()
{

  struct test
  {
    int a;
  } test;

  test.a=1;
}


Additional reference words: 1.00 1.10 1.50 2.00 4.00 4.10 tagname
KBCategory: kbtool kbfixlist kbbuglist kbfasttip
KBSubcategory: WBDebug CvwIss
Keywords : CvwIss WBDebug kbbuglist kbfasttip kbfixlist kbtool
Version : 1.00 1.50 | 1.00 2.00
Platform : NT WINDOWS
Solution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 16, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.