On Sunday, 29 May 2022 at 01:35:23 UTC, frame wrote:
Is there a compiler switch to catch this kind of error?

```d
ulong v = 1;
writeln(v > -1);
```

IMHO the compiler should bail a warning if it sees a logic comparison between signed and unsigned / different integer sizes. There is 50% chance that a implicit conversion was not intended.

Well I don't know about this, but of course I think (That if not) we should have at least a flag like we have with GCC (-Wextra).

Searching about I found in this topic: https://forum.dlang.org/post/hhpacodmcibejatqz...@forum.dlang.org

"Good luck adding a warning into DMD. After years there still isn't a warning for unsigned/signed comparisons."

This is from 2017, so let's wait for experienced weighting in.

Matheus.

Reply via email to