C++ Logo

liaison

Advanced search

Re: [wg14/wg21 liaison] labels

From: Florian Weimer <fw_at_[hidden]>
Date: Wed, 12 Aug 2020 16:26:05 +0200
* Bjarne Stroustrup:

> I consider adding a semicolon there a very minor inconvenience. *If* I
> considered it an improvement not to add the semicolon and wanted to
> change the rule that a label labels a statement, I'd ask myself
>
> Why hasn't anyone bothered for almost 50 years? this cannot be all that
> important even if I like it.

Same reason as for the trailing semicolon in enums?

For label at the end of a compound statement, GCC 2.95 accepted it,
started warning about in GCC 3.0, and then removed support for it in
some later version.

I think it's worthwhile to avoid a situation where a programmer puts
the label at the end of the compound statement in a loop, encounters
the compiler error, and fixes that by moving it to the start of the
loop (which is incorrect).

> When will all tool chains I rely on be completely updated? If I write a
> piece of code using the new rule, it won't compile on any compiler or
> tool that hasn't been updated. Major compilers will comply reasonably
> soon (and may, as Richard point out, quietly start accepting programs
> that are illegal C++ thus exporting the benefits and problems to C++) ,
> third-party tools with smaller user communities may never upgrade. There
> are hundreds, probably thousands, of tools "out there" that rely on some
> sort of C or C++ parsing. Prudent coding standards would have to ban the
> new construct to avoids damaging usability.

That argument applies equally to any language change, so I find it not
very convincing on its own.

Received on 2020-08-12 09:29:32