Re: assert{ 2.0 } - a new kind of assertion



On 29 Jan 2008 20:00:03 GMT, Martin Vuille wrote:

"Paul E. Black" <p.black@xxxxxxx> wrote in
news:fnnpnk02421@xxxxxxxxxxxxxxxxx:

ASSERT(0 <= linebufp-linebuf && linebufp-linebuf <=
line_width)

Here's comes from the last one when the assertion fails

0 <= linebufp-linebuf && linebufp-linebuf <= line_width false
in format.c, line 110


I've done that too, but what's missing is displaying the
actual value of the variables so you can tell what went wrong.

And also the call stack at the spot, and a message to show.

But a far better debugging technique than fake assertions (the true ones
are strict compile-time invariants) is IMO tracing. Such that you can hang
a handler on it. In Gtk+ there is such. Then you can attach a handler that
stops upon an interesting tracing event and breaks into the debugger, so
that you could inspect the stack and the variables around.

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
.