$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Beman Dawes (bdawes_at_[hidden])
Date: 2004-01-04 08:30:50
At 06:19 PM 1/2/2004, Dan W. wrote:
 >While talking about Invariants, DBC, assertions and exceptions in
 >another thread, the subject came up of how useless assert() appears to
 >be, in that it terminates the program.
 >What I always do in my coding is to have a global function...
 >
 >void landing_strip()
 >{
 >   nop();
 >   nop();
 >   nop();
 >}
 >
 >... defining my own assert() that calls it upon evaluating to false, and
 >placing a break in the middle nop(); (3 for breaking distance :)
 >
 >I thought of using a coded break within my assert, but opted not to
 >because that might slow down execution in the debugger (having too many
 >break addresses to compare at each step).
 >
 >In this way, instead of terminating, the code stops at the landing
 >strip, and all I have to do is click on the previous stack level to get
 >back to the caller. Works like a charm, and I bet I'm not the only one
 >using this trick.
 >
 >Would it make sense to generalize this and offer it as an alternative to
 >the standard assert()?  Maybe call it "ensure()"?
How is what you are proposing different from BOOST_ASSERT?
See http://www.boost.org/libs/utility/assert.html
--Beman