C++ Logo

std-proposals

Advanced search

Re: [std-proposals] P2809R0 Infinite loops

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Tue, 4 Apr 2023 18:44:04 +0100
On Tuesday, April 4, 2023, Marcin Jaczewski via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> I wonder why not make infinite loops simply explicit?
> Like:
>
> ```
> while (std::infiniti) { }
> ```
>


Specifically, are you saying that the above loop will fail to compile if it
contains one of the following?
(1) break
(2) throw (without catch)
(3) return
(4) longjmp

Are you saying that the compiler shall terminate compilation and issue a
diagnostic if any of the above four are found inside a loop whose predicate
is 'std::infinity'?

By the way in English we spell it 'infinity'.

Received on 2023-04-04 17:44:06