C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Discussion: A proposed repeat statement for C++

From: scbd Gm <scnd2908gm_at_[hidden]>
Date: Mon, 16 Nov 2026 22:57:44 +0600
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++.


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
>

Received on 2026-11-16 16:58:00