|
Boost : |
From: Jesse Jones (jejones_at_[hidden])
Date: 2001-03-20 17:08:28
>which just makes the code harder to read and maintain. MS did
>something right in this regard in their MFC library where they have
>an ASSERT() which is similar to the classic C assert and a VERIFY()
>which retains the expression in builds without NDEBUG but does not
>halt the program if the expression evaluates to false.
I've used this too. On the whole I think it's a good thing. I also use
DEBUGSTR which is like assert except that it takes just a string. For
example,
switch (n) {
case 0: do stuff
case 1: do more stuff
default: DEBUGSTR("Blah is bad in function foobar");
}
People use assert(false) a lot in code like this, but that's just too
cheesy for me to feel comfortable with.
-- Jesse
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk