C++ Logo

std-proposals

Advanced search

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

From: Jeremy Rifkin <rifkin.jer_at_[hidden]>
Date: Mon, 6 Jan 2025 09:56:50 -0600
> Trying to eliminate goto from the language is counterproductive.

We can talk about gotos or not but I think it’s a red herring.

C is adding labeled break/continue, C++ will too. As far as proposals go
this should be pretty straightforward.

Cheers,
Jeremy

On Mon, Jan 6, 2025 at 05:08 Tiago Freire via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> +1 the sentiment.
>
> Trying to eliminate goto from the language is counterproductive.
>
> You can always eliminate it by “not-using it in your code”.
>
> We should care more on how to go from here.
>
>
>
> *From:* Std-Proposals <std-proposals-bounces_at_[hidden]> *On Behalf
> Of *Richard Hodges via Std-Proposals
> *Sent:* Monday, January 6, 2025 10:57 AM
> *To:* std-proposals_at_[hidden]
> *Cc:* Richard Hodges <hodges.r_at_[hidden]>
> *Subject:* Re: [std-proposals] Bringing break/continue with label to C++
>
>
>
>
>
>
>
> On Sun, 5 Jan 2025 at 15:50, Avi Kivity via Std-Proposals <
> std-proposals_at_[hidden]> wrote:
>
> On Fri, 2024-12-20 at 16:42 +0200, Ville Voutilainen via Std-Proposals
> wrote:
> > On Fri, 20 Dec 2024 at 16:40, Jan Schultke
> > <janschultke_at_[hidden]> wrote:
> > >
> > > > > See, the 'dislike' for goto isn't a 'dislike' at all.
> > >
> > > > Yes, it is.
> > >
> > > Or to be fair, no, I'm wrong. That's not what I was trying to say.
> > >
> > > It totally see the issue with goto. But dislike for using "label:"
> > > syntax IS a pure dislike. It has nothing to do with cyclomatic
> > > complexity and is just a means to circumvent using naming
> > > conventions
> > > and writing linter scripts. It's not technically necessary.
> >
> > Yes, linter scripts can also be used for banning conversions between
> > unrelated pointers, so we don't actually need
> > type safety in a programming language.
> >
> > Or linter scripts can be used to make sure you don't have
> > memory-safety problems in your programs, so we don't
> > need memory-safe programming languages.
> >
> > Linter scripts are a solution yet to show its effectiveness. And
> > that's been the case for various suggestions of their
> > use for more than 40 years.
>
>
> Wouldn't something like -Werror=goto suffice here?
>
>
>
> switch/case is at its core syntactic sugar for a sequence of goto.
>
> continue and break are syntactic sugar for goto.
>
>
>
> Hand wringing over the presence of goto in a program is an utterly
> pointless exercise performed by people who like to pretend that computers
> work differently to the way they actually do.
>
>
> There is absolutely no reason why goto cannot be compiled at compile time.
> If while(1) { if (condition() break; } can work at compile time, so can
> goto.
>
>
>
> Can we stop doing this? It's been 40 years. Honestly...
>
>
>
>
>
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2025-01-06 15:57:06