C++ Logo

std-proposals

Advanced search

Re: [std-proposals] "once" keyword

From: sasho648 <sasho648_at_[hidden]>
Date: Wed, 24 May 2023 18:33:38 +0300
We could have `break if` (and also `break switch`, `break for`, and `break
while` - to break of specific enclosing constructs)

On Wed, May 24, 2023 at 6:23 PM Alejandro Colomar via Std-Proposals <
std-proposals_at_[hidden]> wrote:

>
>
> On 5/24/23 15:48, David Brown via Std-Proposals wrote:
> > I think a better idea here would be to propose allowing "break" inside
> > an "if" statement. That would be simpler, clearer, and have more
> > potential applications - instead of your "once" you'd write "if (true)",
> > and instead of "once (condition)" you'd write "if (condition)".
>
> That would be incompatible with things like:
>
> for (;;) {
> if (x)
> break;
> }
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2023-05-24 15:33:51