C++ Logo

liaison

Advanced search

[wg14/wg21 liaison] labels

From: Uecker, Martin <Martin.Uecker_at_[hidden]>
Date: Tue, 11 Aug 2020 06:37:04 +0000

Hi all,

I recently proposed changes to the C grammar which got
voted into C2X by WG14 (N2508, also see N2496).

This allows placing of labels everywhere in a compound
statement, even before declarations and at the end
of a block, which was not possible in C so far.

Example:

{
start:
  int i;
mid:
  int j;
end:
}

It has been pointed out to me that while C++ allows
labels before declarations, it does not allow them
at the end of a compound statement.

I plan to propose a change to C++ to make this
possible too and I wonder if you have any comments
or suggestions related to this?


Another (old) difference between C is that in C++ you
can use declarations everywhere where statements are
allowed, which includes with iteration, control, and
jump statements.

if (1)
  int i;

This does not make too much sense in the context
of C, so I do not think we will adopt this.

Best,
Martin

Received on 2020-08-11 01:40:36