C++ Logo

std-proposals

Advanced search

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

From: Richard Hodges <hodges.r_at_[hidden]>
Date: Wed, 18 Dec 2024 23:56:25 +0100
Isn't the solution to allow goto in constant expressions and unban it?

It's been useful for 50 years. It seems like a lost cause to try to ban it
on questionable ideological grounds.



On Wed, 18 Dec 2024 at 23:09, JeanHeyd Meneide via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> N3355's syntax is worse because it uses the labels. Unlike other languages
> where labels are somewhat normal and perhaps nicely scoped, labels in C and
> C++ defy scope (they exist inside of the function as a whole). That makes
> it hard to compose and reuse labels; N3377 discusses this and other reasons.
>
> During the discussion in October, WG14 also had hangups around what was
> accepted; the consensus was not unanimous. N3377 will patch up those
> concerns -- including my own -- very nicely.
>
> I look forward to seeing N3377 soon in WG14, and hopefully adding it to
> C2y.
>
> Sincerely,
> JeanHeyd
>
> On Wed, Dec 18, 2024 at 4:10 PM Jens Maurer via Std-Proposals <
> std-proposals_at_[hidden]> wrote:
>
>>
>>
>> On 18/12/2024 11.49, Jan Schultke via Std-Proposals wrote:
>> > I want to have break/continue statements with labels in C++. Now is the
>> time.
>> >
>> > https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3355.htm has been
>> > accepted into C2y, with the syntax:
>> >
>> > label: for (/* ... */) {
>> > while (true) { break label; }
>> > }
>> >
>> > https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3377.pdf proposes to
>> > update this syntax to
>> >
>> > for label (/* ... */) {
>> > while (true) { break label; }
>> > }
>> >
>> > While N3377 may be a bit more syntactically sound (not reusing labels
>> > that are otherwise only goto targets, I'm not a fan of that idea.
>>
>> I think the strictly worst option would be if WG14 picked
>> the N3377 syntax, but WG21 picked the N3355 syntax.
>> So, WG21 needs to know WG14's opinion on N3377 before
>> committing to anything.
>>
>> Jens
>> --
>> 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 2024-12-18 22:56:42