BUG: Changing Radix May Result in Inaccurate Watch Values

Last reviewed: July 22, 1997
Article ID: Q116493
4.10 | 4.10 1.00 1.50 MS-DOS | WINDOWS kbtool kbbuglist

The information in this article applies to:

  • The Visual Workbench Integrated Debugger, included with: Microsoft Visual C++ for Windows, versions 1.0 and 1.5
  • Microsoft CodeView for Windows, version 4.1
  • Microsoft CodeView for MS-DOS, version 4.1

SYMPTOMS

Changing the radix used in either CodeView or the Visual Workbench integrated debugger from 16 (hexadecimal format) to 10 (decimal format) may cause the debugger to display inaccurate values in the watch window. This occurs when a variable has already been displayed first using the hexadecimal radix.

RESOLUTION

Removing the variable from the watch window, then adding it back to the watch window, causes the debugger to display the correct values using the new radix.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This is not a problem in Visual C++, 32-bit Edition. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

You can use the sample code below to illustrate this problem in CodeView for MS-DOS. Build a debug version of the program and follow these steps:

  1. Open the project under CodeView for Windows.

  2. In the command window, type the following commands:

          n 16
          w? buf
    

    This sets the radix to 16 (hexadecimal format) and places the variable "buf" in the watch window.

  3. Expand the buf variable in the watch window by either double-clicking on the variable or moving the cursor to that line and pressing Return. The watch window should then display the correct values for buf.

  4. In the command window, type the following command:

          n 10
    

    This switches the radix back to decimal format. Notice in the watch window that the character array values after 10 have now changed and are not correct.

  5. Move the cursor to the line in the watch window containing buf and then press CTRL+Y to delete buf. Now reenter buf into the watch window and expand it. The values displayed are now correct.

To illustrate this behavior under Windows, rebuild the program as a QuickWin application and follow the steps above using CodeView for Windows. To reproduce the problem in the Visual Workbench integrated debugger, first check the "Hexadecimal Display" check box in the Debug dialog box by choosing Debug from the Options menu in the main menu.

Sample Code

/* Compile options needed: /Zi /Od */

   #include <stdio.h>

   char buf[] = {'\001','\002','\003','\004','\005','\006','\007',
                 '\010','\011','\012','\013','\014','\015','\016',
                 '\017','\020'};

/* NOTE: The buf declaration simply inserts values 1-16 in   */
/* octal. You may use whatever characters you like for this  */
/* test; we are using these to better illustrate the problem.*/

   void main(void)
   {
     printf("Hello World.\n");
   }


Additional reference words: 1.00 1.50 4.10
KBCategory: kbtool kbbuglist
KBSubcategory: CvwIss WBDebug
Keywords : kb16bitonly


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: July 22, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.