Fixing spurious "statement is not reachable" in template code
Jonathan M Davis via Digitalmars-d
digitalmars-d at puremagic.com
Wed Oct 28 07:20:24 PDT 2015
On Wednesday, 28 October 2015 at 10:03:44 UTC, Daniel Murphy
wrote:
> On 28/10/2015 4:02 PM, tsbockman wrote:
>> (But not all control flow statements have static equivalents,
>> so this
>> solution can only be applied to some code. Even if we had
>> `static
>> switch`, `static foreach`, `static goto`, etc., I doubt that
>> forcing the
>> user to segregate all compile-time logic from the run-time
>> logic in that
>> way is desirable.)
>
> Nobody is forcing anyone to do this. Warnings are opt-in.
That's true, but it's generally good practice to compile with
warnings enabled, and it's bad practice to compile with warnings
and not fix them. So, ultimately, a warning isn't all that
different from an error. If push comes to shove, then you can
compile -wi instead of -w and leave the warning in, or you can
choose to not compile with warnings at all, so it's not quite the
same as an error, but it's effectively the same if you're
following what's generally considered good programming practices
(which is part of why I really wish that Walter had never given
in and added warnings to the compiler).
- Jonathan M Davis
More information about the Digitalmars-d
mailing list