C++ Logo

std-proposals

Advanced search

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

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Tue, 7 Jan 2025 02:13:41 +0200
On Tue, 7 Jan 2025 at 01:44, Frederick Virchanza Gotham via
Std-Proposals <std-proposals_at_[hidden]> wrote:
>
> Are you sure we even need 'goto' anymore? Even at runtime? I mean back
> around about 2002, I wrote some spaghetti code with nested loops and
> goto's, but looking back now, I could have just used a simple boolean
> to "double break" instead of "single break", sort of like:
>
> for ( . . . )
> {
> bool double_break = false;
> for ( . . . )
> {
> double_break = true;
> break;
> }
> if ( double_break ) break;
> }
>
> I'm willing to bet . . . if any of you can provide a piece of C++ code
> that relies on the use of 'goto', we'll be able to feed it into
> ChatGPT and get the goto's replaced by simple status variables.
>
> Can anyone provide some C++ code that really needs goto?

For that definition of "needed", we have never needed it, not before
2002 nor after, not after ChatGPT was invented
nor before.

Received on 2025-01-07 00:13:54