Boost logo

Boost :

Subject: Re: [boost] [assert] static_assert envy
From: Beman Dawes (bdawes_at_[hidden])
Date: 2011-01-17 12:24:10


On Mon, Jan 17, 2011 at 10:15 AM, Dean Michael Berris <
mikhailberis_at_[hidden]> wrote:

> On Mon, Jan 17, 2011 at 11:06 PM, Beman Dawes <bdawes_at_[hidden]> wrote:
> >
> > namespace boost { namespace assertion { namespace detail {
> > inline void extended_assert_failed(char const * msg, char const *
> > function,
> > char const * file, long line)
> > {
> > std::cerr << "***** Internal Program Error - Assertion Failed
> *****\n";
> > std::cerr << file << '(' << line << "): error in " << function << ": "
> > << msg << std::endl;
> > std::exit(99999);
> > }
> > }}} // boost::assertion::detail
> >
>
> This caught my eye. Do you really want to hard-code the exit value to
> 99999?

No, and particularly not since 99999 would overflow if int is 16 bits.
But...

Or would you rather use std::abort() just like the normal
> cassert implementation does?
>

On Windows 7 (at least with VC++), abort() pops up one of those "blah.exe
has stopped working" dialog boxes. I haven't been able to kill it, in spite
of lots of google searches, and it drives me crazy.

That said, std::abort() is probably right for many environments.

--Beman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk