Boost logo

Boost Users :

From: Michiel Helvensteijn (m.helvensteijn_at_[hidden])
Date: 2008-07-09 16:27:25


Peter Dimov wrote:

> The reason I used a ?: operator is to make BOOST_ASSERT an expression.
> It's supposed to be a drop-in replacement for assert, and I think that
> assert expands an expression and not a statement.

I can't think of any reason to use assert as an expression. But you're
right, you might as well give BOOST_ASSERT the same behavior.

> Maybe we ought to decorate assertion_failed with
> __attribute__((noreturn))? Or replace the call to assertion_failed with
> (assertion_failed(...), abort())?

They both seem to work. :-)

I guess the __attribute__ technique would be nicest. But it's a GCC
extension. Does this problem exist with other compilers at all? If so,
perhaps they could benefit from using the abort method instead. I don't
have any experience with other compilers.

-- 
Michiel Helvensteijn

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net