|
Boost : |
From: Jesse Jones (jejones_at_[hidden])
Date: 2000-12-18 16:30:49
>I didn't make my point clearly. To avoid ODR violations, either the check
>is done or it's not (it can't be based on NDEBUG). If it is done, then it
>does a poor job of generating efficient code; if it's not done, then it does
>a poor job of catching precondition violations. You can't have it both ways
>and keep ODR happy, too...
OK, I see what you mean now. :-) I don't think an assert that has overhead
in release builds is going to fly in the community at large so AFAICT we
either accept the risk of the occasional ODR violation or forego using
asserts in templates and inlines.
>The best solution is to see if we can get the unnamed namespace thing
>working. That way, we save users from shooting themselves in the foot, too.
>And no n-tuple versions of Boost.
I don't fully understand the "unnamed namespace thing" solution but I
gather that it would only work within boost. If this is true I'm bit
uncomfortable. It seems like every C++ library my app uses would have its
own assert macro which seems a bit silly. Although if they bottle necked to
a function pointer it might not be so bad...
-- Jesse
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk