A code example that shows why I don't like warnings

Johan j at j.nl
Sun Oct 20 17:45:39 UTC 2019

On Sunday, 20 October 2019 at 12:53:22 UTC, Ethan wrote:
> On Friday, 18 October 2019 at 16:38:38 UTC, Adam D. Ruppe wrote:
>> Warning: statement is not reachable
> This is also another valid argument for error/warning codes.
> This exact thing happens *all the time* in my code, and it 
> results in me having to write my static ifs and CTFE functions 
> in a roundabout way just to not get the warning.
> Whereas if I had the warning code, I could tell the compiler to 
> suppress that warning. Exactly like I do in C++.

I once submitted a PR that enabled that functionality (being able 
to silence specific warnings, and the warning itself would 
mention its category), but it was refused. I haven't pursued it 
any further, but am still considering adding it to the better 
compiler for professional use (LDC ofc ;).


[1] https://github.com/dlang/dmd/pull/5592

More information about the Digitalmars-d mailing list