C++ Logo

std-proposals

Advanced search

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

From: Tiago Freire <tmiguelf_at_[hidden]>
Date: Thu, 19 Dec 2024 08:28:49 +0000

> > It will break all current usages of labels that have one of those control flow gadgets following it.
> How so?
> > label: while (true) { /* .. */ }
> > goto label;
> This code was valid, and remains valid. No code is broken.

I guess that would technically work.
But now you can't not define a label where you can use goto, but also all labels must be associable to statements that follow it.
Not to mention that this comes with all the restrictions of existing labels, such as the name being unique everywhere in the function instead of creating a temporary spot.

Received on 2024-12-19 08:28:55