FIX: Incorrect Debugging Information for Nested Classes

Last reviewed: September 16, 1997
Article ID: Q102166
1.00    | 1.00
WINDOWS | WINDOWS NT kbtool kbbuglist kbfixlist kbfasttip

The information in this article applies to:

  • The Microsoft C/C++ Compiler (CL.EXE), included with:

        - Microsoft Visual C++ for Windows, version 1.0
        - Microsoft Visual C++, 32-bit Edition, version 1.0
    

SYMPTOMS

An attempt to expand a local variable in the Local or Watch window may fail and display incorrect values.

CAUSE

The data type of the local variable uses nested classes.

RESOLUTION

To work around this problem, specify the /Z7 compiler option switch when you build the application.

STATUS

Microsoft has confirmed this to be a problem in the C/C++ Compiler (CL.EXE) version 8.0 for Windows. This problem was corrected in C/C++ compiler version 8.0c, included in Visual C++ for Windows, version 1.5.

MORE INFORMATION

When you debug the code example below in Visual C++ version 1.0, the local objects a and b refer to nested class C defined in class A when you expand the objects. This problem does not occur in Microsoft C/C++ version 7.0 for MS-DOS.

Sample Code

/*
 * Compiler options needed: /Zi /Od
 */

class A { public:
   class C
   {
   public:
      int *a;
   };
   C *temp;
};

class B { public:

   class C
   {
   public:
      float *a;
   };
   C *temp;
};

void main(void)
{
   A a; B b;   // b refers to nested class C defined in class A
}


Additional reference words: 1.00 8.00
KBCategory: kbtool kbfixlist kbfasttip kbbuglist
KBSubcategory: CPPIss
Keywords : CPPIss kb16bitonly kbbuglist kbfasttip kbfixlist kbtool
Version : 1.00 | 1.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.