I completely agree. The only reason why people want the expr to be evaluated
in the no-debug case is that some broken kasserts might have side effects.
This argument is specious: fix the asserts. One way to make such
broken asserts a bit easier to find is to do something like
#define kassert(cond) \
if ((cond) && ((cond) == (cond))) {} else {burp}
It doesn't catch all cases, far from that, but has the advantage of only
slowing down the debug case. There could be several kassert behaviors (even
changeable at run time):
- default: just do the check and print any error
- no debug: replace kassert with (void)0
- debug asserts: use the multiple-eval trick above to increase the chances
of catching buggy asserts.
and orthogonal to that, you could choose whether to oops/panic/donothing
in case of an actual failure.
Stefan
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/