C++ Logo

liaison

Advanced search

Re: [wg14/wg21 liaison] labels

From: Jens Maurer <Jens.Maurer_at_[hidden]>
Date: Tue, 11 Aug 2020 17:29:07 +0200
On 11/08/2020 08.37, Uecker, Martin via Liaison wrote:
>
> 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?

I'm lukewarm on this. Your example becomes valid C++
by adding a ";" after the "end:".

So, having the change does not materially alter the
expressiveness of the common subset of C++ and C.

I'd like to see the wording change for C++ to understand
whether it's likely low-cost overall to add this.

Jens

Received on 2020-08-11 10:32:34