Microsoft KB Archive/117384

= BUG: Unable to Hit Breakpoint on ELSE IF Statement =

PSS ID Number: 117384

Article Last Modified on 10/16/2002

-

The information in this article applies to:

 Microsoft C/C++ Compiler (CL.EXE), when used with:  Microsoft C/C++ for MS-DOS

 Microsoft Visual C++ for Windows, 16-bit edition 1.0

 Microsoft Visual C++ for Windows, 16-bit edition 1.5

 Microsoft Visual C++, 32-bit Editions 1.0</li></ul>

 Microsoft Visual C++, 32-bit Editions 2.0</li></ul>

 Microsoft Visual C++, 32-bit Editions 2.1</li></ul>

 Microsoft Visual C++, 32-bit Editions 4.0</li></ul>

 Microsoft Visual C++, 32-bit Editions 4.1</li></ul>

 Microsoft Visual C++, 32-bit Editions 4.2</li></ul>

 Microsoft Visual C++, 32-bit Editions 5.0</li></ul>

 Microsoft Visual C++, 32-bit Editions 6.0</li></ul>

 Microsoft Visual C++ .NET (2002)</li></ul> </li></ul>

-

<div class="notice_section">

This article was previously published under Q117384

<div class="symptoms_section">

SYMPTOMS
If the sample code in the "MORE INFORMATION" section, below, is compiled for debugging (/Zi), the debugger (either CodeView or the Visual Workbench) does not stop at a breakpoint that is placed on the ELSE IF statement.

<div class="cause_section">

CAUSE
The compiler does not generate the correct symbolic information for the line of code containing the ELSE IF statement.

<div class="resolution_section">

RESOLUTION
To work around the problem, place the "else" and "if" statements on separate lines. For example: else if (i==7)

<div class="status_section">

STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

<div class="moreinformation_section">

MORE INFORMATION
To reproduce this problem with the sample code below:
 * 1) Set a breakpoint on the line with the ELSE IF statement
 * 2) Press F5 (GO) to start debugging the program.

Neither debugger stops running until the program is finished, unless you set a breakpoint on a different line of code.

In CodeView, if you switch into mixed source/assembly mode, you can verify that there is executable code associated with the ELSE IF statement. If a breakpoint is placed on one of the lines of assembly code for the ELSE IF statement and the application is debugged, the code stops running at the breakpoint. With the Visual Workbench debugger, step through the code at the ELSE IF statement to set the breakpoint.

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

void main(void) {     int i=100; if (i==2); else if(i==7); /* cannot stop on this line */ }

Additional query words: kbVC400bug 6.00 8.00 8.00c 9.00 10.00 10.10 10.20

Keywords: kbBug kbCompiler KB117384

Technology: kbAudDeveloper kbCVCComp kbvc100 kbvc150 kbVC16bitSearch kbVC200 kbVC210 kbVC32bitSearch kbVC400 kbVC410 kbVC420 kbVC500 kbVC500Search kbVC600 kbVCNET kbVCsearch kbZNotKeyword3 kbZNotKeyword8

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© 2003 Microsoft Corporation. All rights reserved.