[Issue 904] Bad code generated for local _assert routine

Sean Kelly sean at f4.ca
Wed Jan 31 07:31:26 PST 2007


d-bugmail at puremagic.com wrote:
>
> It's not invalid code. The function is never supposed to return, therefore, it
> doesn't need any cleanup code. Replacing it with a function that does return
> will break use of asserts that assume that failed asserts don't continue.
> Changing behavior globally is often a problem because of 3rd party code linked
> in that assumes the defined behavior.

This is a valid point.  I do think there is some value in providing a 
returning assert handler for debugging purposes, but I won't press the 
matter.  However, I remain somewhat concerned that limiting the behavior 
of the assert handler in this manner will inspire the use of custom 
error signaling routines and reduce the overall utility of assert, but 
perhaps this is unwarranted.

> The optimizer assumes tripped asserts don't return, so having it return will
> introduce some subtle bugs.

Valid as well.  I suppose I'll leave the ability to supply a custom 
assert handler in place and simply document that it must either throw or 
terminate the program.


More information about the Digitalmars-d-bugs mailing list