This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 113d. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-03-20


631. Jumping into a “then” clause

Section: 8.5.2  [stmt.if]     Status: CD3     Submitter: James Kanze     Date: 24 April 2007

[Moved to DR at the October, 2012 meeting.]

8.5.2 [stmt.if] is silent about whether the else clause of an if statement is executed if the condition is not evaluated. (This could occur via a goto or a longjmp.) C99 covers the goto case with the following provision:

If the first substatement is reached via a label, the second substatement is not executed.

It should probably also be stated that the condition is not evaluated when the “then” clause is entered directly.

Proposed resolution (February, 2012):

Change 8.5.2 [stmt.if] paragraph 1 as follows:

If the condition (8.5 [stmt.select]) yields true the first substatement is executed. If the else part of the selection statement is present and the condition yields false, the second substatement is executed. If the first substatement is reached via a label, the condition is not evaluated and the second substatement is not executed. In the second form...