C++ Logo

std-proposals

Advanced search

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

From: Ivan Lazaric <ivan.lazaric1_at_[hidden]>
Date: Tue, 17 Nov 2026 14:15:40 +0100
> The main downside of `goto` is that it can't be used during constant
evaluation, but I don't think this is a strong enough reason to add new
keywords to the core language.

I hope one day we allow goto in constexpr. Not really aware of proposals
pursuing this, relevant stuff:
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4472.html
https://cplusplus.github.io/EWG/ewg-closed.html#186


On Mon, Nov 16, 2026 at 5:54 PM Brian Bi via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> I think so. It's equivalent to using `goto` to jump back to the beginning
> of the loop body.
>
> I'm against adding new niche control flow constructs. You can just use
> `goto`. We have `goto` in the language for a reason, which is that
> sometimes you need to use it because none of the "more structured" control
> flow constructs comfortably accommodate the control flow that you want.
> Excessive use of `goto` is a code smell, but occasional, justified use is
> not a problem.
>
> The main downside of `goto` is that it can't be used during constant
> evaluation, but I don't think this is a strong enough reason to add new
> keywords to the core language.
>
> On Mon, Nov 16, 2026 at 1: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
>>
>
>
> --
> *Brian Bi*
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2026-11-17 13:15:56