Date: Thu, 19 Dec 2024 04:49:48 +0300
On 12/19/24 03:21, Oliver Hunt via Std-Proposals wrote:
>> 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++.
Is there an objective metric by which those alternatives are better?
Because the motivation I've seen so far is "because people think goto is
bad because... we don't like it" which is subjective. I, for one, do not
see how a labeled break is better than a goto. In fact, I think it's
worse because it breaks the existing label usage. Previously, switch and
goto would jump to a label, now break and continue with a label jump
somewhere else instead of the label.
Honestly, people, just use goto. There's nothing wrong with it.
>> 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++.
Is there an objective metric by which those alternatives are better?
Because the motivation I've seen so far is "because people think goto is
bad because... we don't like it" which is subjective. I, for one, do not
see how a labeled break is better than a goto. In fact, I think it's
worse because it breaks the existing label usage. Previously, switch and
goto would jump to a label, now break and continue with a label jump
somewhere else instead of the label.
Honestly, people, just use goto. There's nothing wrong with it.
Received on 2024-12-19 01:49:51