[Issue 2423] Erroneous unreachable statement warning

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Nov 19 16:38:09 PST 2008


http://d.puremagic.com/issues/show_bug.cgi?id=2423


smjg at iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg at iname.com




------- Comment #5 from smjg at iname.com  2008-11-19 18:38 -------
(In reply to comment #3)
> Erm, actually, I wonder if this is even valid.  do-while loops in D do not
> require a semicolon at the end.  The "unreachable statement" is simply the
> empty statement that follows the "while(true)".  The following code:

It's valid, it just throws a warning.  ISTM not having the semicolon at the end
of DoStatement was a bad design decision - if you stumble upon

    }
    while (whatever)
    {

in the middle of some code, you have to look through possibly screenfuls of
code to determine whether the while applies to the preceding block (and the
following one just opens a new scope for whatever reason) or the following
block.

Meanwhile, the conditions under which "statement is not reachable" is thrown
ought to be changed to exclude empty statements.


-- 



More information about the Digitalmars-d-bugs mailing list