[Issue 904] Bad code generated for local _assert routine

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jan 31 01:02:49 PST 2007


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


bugzilla at digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |INVALID




------- Comment #4 from bugzilla at digitalmars.com  2007-01-31 03:02 -------
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.

Inserting your own logging code doesn't change this, it should log and then not
return.

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

The local assert function has always been like this, it was probably a fluke
that it appeared to work in the past.

Logging errors and continuing is not what assert is for, so something else
should be used for that purpose.


-- 



More information about the Digitalmars-d-bugs mailing list