C++ Logo

std-proposals

Advanced search

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

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Mon, 6 Jan 2025 23:44:49 +0000
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?

Received on 2025-01-06 23:44:05