Microsoft KB Archive/104676

From BetaArchive Wiki

BUG: this Pointer Expands Incorrectly for Multiple Inheritance

Q104676

4.10 | 1.00 1.50 1.51 1.52 4.10 MS-DOS | WINDOWS kbtool kbcode kbbuglist --------------------------------------------------------------------------- The information in this article applies to: - Microsoft CodeView for MS-DOS, version 4.1 - Microsoft CodeView for Windows, version 4.1 - The integrated debugger included with: - Microsoft Visual C++ for Windows, versions 1.0, 1.5, 1.51, and 1.52 --------------------------------------------------------------------------- SYMPTOMS ======== Expanding the "this" pointer of a class with multiple inheritance displays incorrect information. CAUSE ===== The class type is derived from more than one classes. STATUS ====== Microsoft has confirmed this to be a problem in Microsoft CodeView version 4.1 for MS-DOS and Windows and in the Visual Workbench Debugger that ships with Visual C++ for Windows, version 1.0. The problem does not occur with the Visual Workbench Debugger that ships with Visual C++ 32-bit Edition or with CodeView for Win32s version 4.25. MORE INFORMATION ================ When you debug the sample code below, expanding the this pointer of the class collection in a Watch window displays the following: -this = 0x45CA:0x09A2 -base1 = {...} -base1 = CXX0030: Error: expression cannot be evaluated +base1 = CXX0030: Error: expression cannot be evaluated +base2 = CXX0030: Error: expression cannot be evaluated c = CXX0030: Error: expression cannot be evaluated -base2 = CXX0030: Error: expression cannot be evaluated +base1 = CXX0030: Error: expression cannot be evaluated +base2 = CXX0030: Error: expression cannot be evaluated c = CXX0030: Error: expression cannot be evaluated c = CXX0030: Error: expression cannot be evaluated -base2 = {...} +base1 = CXX0030: Error: expression cannot be evaluated +base2 = CXX0030: Error: expression cannot be evaluated c = CXX0030: Error: expression cannot be evaluated c = 12870 The base1 and base2 classes incorrectly appear more than once in the expanding process. Sample Code ----------- /* * Compiler options needed: /Zi /Od */ class base1{ public: int a; }; class base2{ public: int b; }; class collection:public base1,public base2 { public: int c; void sub(); }; void collection::sub() { a=100; // Set a breakpoint here and watch this pointer. b=200; c=300; } void main() { collection k; k.sub(); } Additional reference words: 4.10 1.00 1.50 KBCategory: kbtool kbcode kbbuglist KBSubcategory: WBDebug CvwIss

Keywords : kb16bitonly
Issue type : kbbug
Technology : kbVCsearch kbAudDeveloper


Last Reviewed: May 5, 2001
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.