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 15:49:18 +0200
On Fri, 20 Dec 2024 at 15:43, Jan Schultke <janschultke_at_[hidden]> wrote:
>
> > That naming conventions are not actual semantics?
>
> Sure, but what is the technical reason why you need different syntax?

That it's separate from labels and thus not subject to being a target of a goto.

> The argument seems to be "I'm uncomfortable with label: being able to
> give a name to goto targets and loops."

No, the reason is to separate those targets so that the unstructured
language facility
(goto) is not allowed to jump to the loop-name, and it's therefore
reserved for the more-structured
language facilities, meaning labeled break and continue. Which have
clear semantics and purpose,
and can be reasoned about where they jump and how.

Received on 2024-12-20 13:49:31