Date: Wed, 18 Dec 2024 16:21:34 -0800
> On Dec 18, 2024, at 2:56 PM, Richard Hodges via Std-Proposals <std-proposals_at_[hidden]> wrote:
>
> Isn't the solution to allow goto in constant expressions and unban it?
Adding goto does nothing to help here.
some_label: while(…) {
...
goto some_label;
}
Does not provide break *or* continue semantics which is what this feature is.
Constexpr support for goto is not relevant.
> It's been useful for 50 years. It seems like a lost cause to try to ban it on questionable ideological grounds.
Yes, it has been “useful" because better alternatives - alternatives that exist in other languages - are not available in C and C++. The only “good” use cases I’ve seen in general use are bodges attempting to emulate (poorly) labeled break/continue and “defer” semantics. The other uses of goto I have seen in production code are machine generated C/C++ (e.g. function low cost custom code generators) or interpreters (which is computed goto, and that isn’t part of any spec IIRC).
—Oliver
>
> Isn't the solution to allow goto in constant expressions and unban it?
Adding goto does nothing to help here.
some_label: while(…) {
...
goto some_label;
}
Does not provide break *or* continue semantics which is what this feature is.
Constexpr support for goto is not relevant.
> It's been useful for 50 years. It seems like a lost cause to try to ban it on questionable ideological grounds.
Yes, it has been “useful" because better alternatives - alternatives that exist in other languages - are not available in C and C++. The only “good” use cases I’ve seen in general use are bodges attempting to emulate (poorly) labeled break/continue and “defer” semantics. The other uses of goto I have seen in production code are machine generated C/C++ (e.g. function low cost custom code generators) or interpreters (which is computed goto, and that isn’t part of any spec IIRC).
—Oliver
Received on 2024-12-19 00:21:36