C++ Logo

liaison

Advanced search

Re: [wg14/wg21 liaison] labels

From: Uecker, Martin <Martin.Uecker_at_[hidden]>
Date: Tue, 11 Aug 2020 11:04:44 +0000
Am Dienstag, den 11.08.2020, 10:09 +0100 schrieb Niall Douglas via Liaison:
> On 11/08/2020 07:37, Uecker, Martin via Liaison wrote:
>
> > 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.
>
> Long overdue! And thank you for the work to fix this.
>
> > 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?
>
> My first reaction is simply "just insert a ;". Perhaps that won't be a
> common reaction.

Well, this is was what some also said about labels before
declarations...

So you would not need to see a use for this in C++?

> Is there any chance that you might propose C standardising computed
> gotos? Then Python on MSVC goes +30% faster. You would, quite literally,
> save millions of kWh of wasted electricity in the next few decades.

I will put it on my list... I think the type should
not be void* for labels. Maybe:

noreturn void (*addr)(void);

(sadly noreturn is not part of the type though...)

Best,
Martin

Received on 2020-08-11 06:08:14