C++ Logo

std-proposals

Advanced search

Re: [std-proposals] "once" keyword

From: David Brown <david_at_[hidden]>
Date: Wed, 24 May 2023 16:27:58 +0200
On 24/05/2023 15:49, Arthur O'Dwyer via Std-Proposals wrote:

> David Brown wrote:
> > I think a better idea here would be to propose allowing "break"
> inside an "if" statement.
>
> As in `if (x > 5) break;`? I think you should rethink that idea. ;)
>

Good point :-)

I was, obviously, thinking about cases with a block - "if (x) { ... }".
But of course a "break" there would currently mean breaking out of an
enclosing "while" or "for", so my suggestion still would not work. I
still think it would be useful to have a way of breaking out of an "if",
but not at the cost of breaking existing code!

Received on 2023-05-24 14:28:03