C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Bringing break/continue with label to C++

From: Jan Schultke <janschultke_at_[hidden]>
Date: Fri, 20 Dec 2024 13:38:56 +0100
Thanks for your feedback. The latest draft addresses this goto
label/break label ambiguity under
https://eisenwave.github.io/cpp-proposals/break-continue-label.html#n3377-label-disambiguation

I do think that it's a genuine concern, and it can be addressed
without splitting the syntax in two. In short, the draft makes the
following points:

1. "outer: for ..." is almost always targeted by break/continue, and
"cleanup: free" can only be targeted by "goto", so the potential for
ambiguity may be overstated.

2. Ambiguity can be avoided through conventions. For example, by using
"xzy_loop" for all (and only for) break/continue targets.

Having two separate syntaxes seems like a much bigger hammer to me. If
we can solve a problem simply by naming conventions (assuming it even
is a problem, which it usually shouldn't be in modern C++ code bases,
which GCC isn't), then we should do so.

Received on 2024-12-20 12:39:10