The information in this article applies to:
SYMPTOMSOn page 17 in chapter 2 of the C++ Tutorial included in Microsoft C/C++, version 7.0 and Visual C++, version 1.0, it states: "Constants declared with const have an advantage over those defined by #define in that they are accessible to a symbolic debugger, making debugging easier."However, when global constants are used in a C++ program, they cannot be watched in a local or watch window with CodeView or the Integrated (IDE) Debugger in Visual C++. RESOLUTIONThe above behavior is by design in the products listed above. In these versions, with the exception of CodeView 4.25 for Win32S, only local constants are accessible to CodeView and the Visual C++ IDE debugger. CAUSEIn Microsoft C++, storage of global constants is optimized for the purpose of saving space, therefore no debug information is generated. MORE INFORMATIONWhen debugging the following C++ sample program with CodeView, attempting to watch the global const a yields the following error: Attempting to watch A using the Visual C++ for Windows version 1.0 or the Visual C++ 32-bit Edition version 1.0 or 2.1 IDE Debugger yields a dialog box with the following text: Attempting to watch A using the Visual C++ 32-bit Edition version 4.0 IDE Debugger produces the following in the Watch window:
Sample Code
Additional query words: utilities
Keywords : kbCodeView kbDebug kbide kbVC |
Last Reviewed: February 2, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |