Superfluous code in switch statement

Timon Gehr via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Sep 4 14:20:10 PDT 2015


On 09/04/2015 11:12 PM, anonymous wrote:
> On Friday 04 September 2015 23:04, Timon Gehr wrote:
>
>> DMD never warns about dead code.
>
> It warns here:
>
> ----
> import std.stdio;
> void main()
> {
>      return;
>      writeln("hi"); /* Warning: statement is not reachable */
> }
> ----
>

You are right, it does. Then I suppose there is no reason why it 
shouldn't warn in the switch case.


More information about the Digitalmars-d-learn mailing list