Should unreachable code be considered an error?

Rory McGuire rjmcguire at gmail.com
Tue Sep 20 01:17:30 PDT 2011


Perhaps a warning, there are to many ways to make "unreachable" code
reachable. In other words, it is surely too much work to implement
currently.
Plus I find it annoying in Java when that happens, because often I'm just
quickly testing a different return.

-Rory

On Mon, Sep 19, 2011 at 2:06 AM, Stewart Gordon <smjg_1998 at yahoo.com> wrote:

> 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.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20110920/9a62fef9/attachment.html>


More information about the Digitalmars-d mailing list