Unreachable code: error or warning? [closed]

An error means that the compiler is physically unable to deal with your code.

A warning means that the compiler is capable of dealing with your code, but it believe that what you have written is wrong in some way.

It seems pretty clear cut to me – it should be a warning.

Besides, what about the case where I’ve decided to shorten a method for debugging purposes:

public bool ShowMenu()
    return true;
    /* The standard implementation goes here */

I know its wrong, but for the compiler to ask me to also comment out that code would just be a pain.

Leave a Comment