Title
#elif with invalid controlling expression
Status
cd4
Section
15.2 [cpp.cond]
Submitter
Jonathan Wakely

Created on 2014-06-25.00:00:00 last changed 87 months ago

Messages

Date: 2014-11-15.00:00:00

Proposed resolution (November, 2014):

Change 15.2 [cpp.cond] paragraph 6 as follows:

Each directive's condition is checked in order. If it evaluates to false (zero), the group that it controls is skipped: directives are processed only through the name that determines the directive in order to keep track of the level of nested conditionals; the rest of the directives' preprocessing tokens are ignored, as are the other preprocessing tokens in the group. Only the first group whose control condition evaluates to true (nonzero) is processed; any following groups are skipped and their controlling directives are processed as if they were in a group that is skipped. If none of the conditions...
Date: 2016-02-15.00:00:00

[Adopted at the February, 2016 meeting.]

An #elif is treated differently from an #else followed immediately by an #if: assuming the preceding #if's condition was true, the condition in the second #if need not be a valid expression, while the condition in the #elif directive, though not evaluated, still must be syntactically correct.

C DR 412 changes that for C; C++ should make the corresponding change.

History
Date User Action Args
2017-02-06 00:00:00adminsetstatus: ready -> cd4
2015-11-10 00:00:00adminsetstatus: review -> ready
2014-11-24 00:00:00adminsetmessages: + msg5178
2014-06-25 00:00:00admincreate