Should unreachable code be considered an error?

Stewart Gordon smjg_1998 at yahoo.com
Sun Sep 18 17:06:16 PDT 2011


On 31/08/2011 09:56, Don wrote:
<snip>
> What if range.empty is simply the compile-time constant 'false'?

That's exactly the case I've just covered.

> Isn't:
> if (false) {...}
> unreachable code?
> If it doesn't create an error, what would?

     doSomething();
     return;
     doSomethingElse();

including more complicated equivalents like

     if (condition) {
         return something;
     } else {
         return somethingElse;
     }
     doSomethingElse();

Stewart.


More information about the Digitalmars-d mailing list