[Issue 12342] Deprecate not reachable code?

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Mar 11 05:10:01 PDT 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12342


Andrej Mitrovic <andrej.mitrovich at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich at gmail.com


--- Comment #3 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2014-03-11 05:09:46 PDT ---
Personally I find it extremely annoying when I get "unreachable" errors for
assert(0);. Sometimes I want to add it just to figure out whether execution has
reached some part of my code, e.g.:

-----
void function() fp1;
void function() fp2;

void main()
{
    fp1();

    assert(0);  // triggers warning

    fp2();
}
-----

Without the assert(0) I can't tell from the stack-trace at what point something
went wrong:

------
object.Error: Access Violation
------

With the assert injected, if it is reached I'll get back:

core.exception.AssertError at test(8): Assertion failure

Which at least tells me the code before line 8 works ok.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list