[Issue 1931] dmd flow analysis error

Janice Caron caron800 at googlemail.com
Thu Apr 24 23:40:04 PDT 2008


On 25/04/2008, d-bugmail at puremagic.com <d-bugmail at puremagic.com> wrote:
>  Every such piece code *should be* written as following:
>  bool setsomething()
>  {
>     if (k==4)
>         return false;
>     assert(0);        // developer should never ignore this line!!
>  }

Usefully, that's exactly what happens if you use the -w command line switch.

I would certainly support raising this from a warning to an error.
After being clobbered by this nasty crashing behavior once too often,
I now /always/ compile with -w. But it pains me that every single D
user* has to learn this lesson the hard way.

----
*or at least, every single /Windows/ D user. I'm told that falling off
the end of a function on Linux is less crashy and more diagnostic than
doing so on Windows, but not being a Linux user, I can't confirm that.


More information about the Digitalmars-d-bugs mailing list