maybe a noreturn issue

Basile B. b2.temp at gmx.com
Tue Dec 3 12:43:31 UTC 2024


On Tuesday, 3 December 2024 at 12:41:18 UTC, Basile B. wrote:
> Not sure if that should compile
>
> ```d
> int f()
> {
>     while (true) {}
> }
> ```
>
> What I observe and think right now is:
>
> 1. if you remove the while statement, you get an error about 
> return statement missing
> 2. here the compiler detects that `f` while not return, in 
> consequence it should not accept the input and says that `f` 
> return type should be `noreturn`.
>
> What's you're position ?

"f will not return"

to avoid any misunderstanding.


More information about the Digitalmars-d-learn mailing list