C++ Logo

std-proposals

Advanced search

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

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Fri, 20 Dec 2024 14:05:57 +0200
On Fri, 20 Dec 2024 at 13:33, Tiago Freire via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> > Tiago, you're the only person here who keeps insisting that "goto labels" are fundamentally different from "loop labels".
>
> No. I'm proposing that they fundamentally should be.
>
> label: for(...)
> {
> if(cond1) break label;
> if(cond2) continue label;
> if(cond3) goto label;
> }
>
> Are 3 different jumps
>
> I want to be able to break and continue on a certain loop, not create a point where goto can be used.

Likewise. When I see a named loop, I don't have to worry about and
look for gotos jumping to its label,
the problem never comes up. When it's a label that goto can also jump
to, I do have to worry about that and look
for the gotos.

Received on 2024-12-20 12:06:12