Re: maybe a noreturn issue

2024-12-03 Thread Nick Treleaven via Digitalmars-d-learn
On Tuesday, 3 December 2024 at 12:41:18 UTC, Basile B. wrote: Not sure if that should compile ```d int f() { while (true) {} } ``` The spec allows that: https://dlang.org/spec/function.html#function-return-values

Re: maybe a noreturn issue

2024-12-03 Thread Dennis via Digitalmars-d-learn
On Tuesday, 3 December 2024 at 12:41:18 UTC, Basile B. wrote: What's you're position ? I often see suggestions to raise warnings/errors for ostensibly 'useless constructs', such as unused parameters, if (0), strongly pure functions returning void etc. In my experience, doing this rarely cat

Re: maybe a noreturn issue

2024-12-03 Thread Basile B. via Digitalmars-d-learn
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