C++ Logo

std-proposals

Advanced search

Re: More flexible break statements.

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Fri, 16 Aug 2019 23:05:53 +0300
On Fri, 16 Aug 2019 at 22:59, Walt Karas via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> 1. 'break short;' statement would break out of the immediately enclosing compound statement. This would eliminate the need for the 'do { /* yada */ } while (0);' idiom. It would be an error if the immediately enclosing compound statement were a function body. (If the compound statement was a direct component of an iteration statement, 'break short;' would be the same as 'continue;'.)
>
> 2. 'break LABEL;' statement would break out of a directly or indirectly enclosing statement immediately preceded by the label 'LABEL:'. It would be an error if no such statement existed.

Yeah, well, these ideas pop up every now and then. A paper containing
them, http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3879.pdf,
was discussed and rejected in Rapperswil 2014.

Received on 2019-08-16 15:08:06