C++ Logo

liaison

Advanced search

Re: [wg14/wg21 liaison] labels

From: Uecker, Martin <Martin.Uecker_at_[hidden]>
Date: Tue, 11 Aug 2020 20:11:14 +0000


Am Dienstag, den 11.08.2020, 21:31 +0200 schrieb Bjarne Stroustrup:
> What benefits was this supposed to give programmers?

It actually saves me time when writing C, because currently
have to recompile sometimes just to add a pointless
null statements. It is one of the main annoyances
when writing C.

It is also difficult to explain to students
why you can not place a label before a declaration or
at the end of a block while it makes perfect sense
to jump there.

C++ allows placing labels in front of declarations,
so the also improves compatibility.

> Was the benefits worth the change to almost 50 years practice and
> documentation worth it?

There is hardly anything to change, as it is entirely
backward compatible and simply removes an annoying
corner case from the language.

> Are the old corner cases worse than the new ones?

In C, there a no corner case anymore. You can place a label
everywhere you could place a statement.


Best,
Martin


> On 8/11/2020 6:43 PM, Richard Smith via Liaison wrote:
> > On Tue, 11 Aug 2020, 09:16 Uecker, Martin,
> > <Martin.Uecker_at_[hidden]gen.de
> > <mailto:Martin.Uecker_at_[hidden]>> wrote:
> >
> > Am Dienstag, den 11.08.2020, 09:04 -0700 schrieb Richard Smith:
> > > On Mon, 10 Aug 2020, 23:37 Uecker, Martin via Liaison, <
> >     > liaison_at_lists.isocpp.org <mailto:liaison_at_lists.isocpp.org>> 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:
> >     > > }
> >     > > 
> >

Received on 2020-08-11 15:14:43