Date: Tue, 17 Nov 2026 00:57:39 +0100
pon., 16 lis 2026 o 17:58 scbd Gm via Std-Proposals
<std-proposals_at_[hidden]> napisaĆ(a):
>
> I believe this feature could provide cleaner and more explicit control flow in C++.
>
> Consider the existing break statement. Although similar behavior can be achieved using goto, having a dedicated break statement makes the programmer's intention much clearer and the code easier to maintain.
>
> I see repeat in a similar way. Its behavior can technically be implemented using goto, but doing so can become messy, particularly in large codebases and nested loops.
>
> A dedicated repeat statement would make this operation explicit, improve readability, and allow programmers to express the intention of restarting the current iteration without manually managing labels and jump targets.
>
> I'm not arguing that this behavior is impossible with existing C++ features. Rather, I believe providing a dedicated language construct could make certain control-flow patterns cleaner and easier to understand.
>
> I'd appreciate feedback on whether this would be a worthwhile addition to C++.
>
Two things:
It breaks all programs as "repeat" is a common word.
Second, its easy to have broken loops as you can easily create an
infinite loop, `continue` and `break` do not behave this way and are
always safe as they always jumps "forward".
>
>
> On Mon, Nov 16, 2026 at 10:50 PM Anoop Rana via Std-Proposals <std-proposals_at_[hidden]> wrote:
>>
>> Can this already be achieved by using existing features of the C++ language? If yes, why "repeat" it. If not, list some use cases for this.
>>
>> On Mon, 16 Nov 2026, 22:12 Vinnie Falco via Std-Proposals, <std-proposals_at_[hidden]> wrote:
>>>
>>> On Mon, Nov 16, 2026 at 8:41 AM scbd Gm via Std-Proposals <std-proposals_at_[hidden]> wrote:
>>>>
>>>> I'm interested in proposing a new C++ control-flow statement called repeat.
>>>
>>> What?
>>> --
>>> 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
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
<std-proposals_at_[hidden]> napisaĆ(a):
>
> I believe this feature could provide cleaner and more explicit control flow in C++.
>
> Consider the existing break statement. Although similar behavior can be achieved using goto, having a dedicated break statement makes the programmer's intention much clearer and the code easier to maintain.
>
> I see repeat in a similar way. Its behavior can technically be implemented using goto, but doing so can become messy, particularly in large codebases and nested loops.
>
> A dedicated repeat statement would make this operation explicit, improve readability, and allow programmers to express the intention of restarting the current iteration without manually managing labels and jump targets.
>
> I'm not arguing that this behavior is impossible with existing C++ features. Rather, I believe providing a dedicated language construct could make certain control-flow patterns cleaner and easier to understand.
>
> I'd appreciate feedback on whether this would be a worthwhile addition to C++.
>
Two things:
It breaks all programs as "repeat" is a common word.
Second, its easy to have broken loops as you can easily create an
infinite loop, `continue` and `break` do not behave this way and are
always safe as they always jumps "forward".
>
>
> On Mon, Nov 16, 2026 at 10:50 PM Anoop Rana via Std-Proposals <std-proposals_at_[hidden]> wrote:
>>
>> Can this already be achieved by using existing features of the C++ language? If yes, why "repeat" it. If not, list some use cases for this.
>>
>> On Mon, 16 Nov 2026, 22:12 Vinnie Falco via Std-Proposals, <std-proposals_at_[hidden]> wrote:
>>>
>>> On Mon, Nov 16, 2026 at 8:41 AM scbd Gm via Std-Proposals <std-proposals_at_[hidden]> wrote:
>>>>
>>>> I'm interested in proposing a new C++ control-flow statement called repeat.
>>>
>>> What?
>>> --
>>> 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
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
Received on 2026-11-16 23:57:55
