Boost logo

Boost :

From: Rainer Deyke (root_at_[hidden])
Date: 2001-04-13 16:01:35


----- Original Message -----
From: <williamkempf_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Friday, April 13, 2001 10:22 AM
Subject: [boost] Boost.Assertion
> 2) Require applications to implement boost::assertion_handler(),
> much as they need to implement main(). In many ways this is the best
> solution, however it's intrusive on the user. If Boost.Threads used
> Boost.Assertions internally the user may not realize this until
> compile time when a link error will occur. If the user isn't
> familiar with Boost.Assertions this link error may confuse the user.

It might be possible to provide a default handler and allow the user to
override it. Something like this:

// In boost header:
template<class T> void assertion_handler(T) {}
void f(int *p)
{
  if (!p) assertion_handler(1);
}

// In user code:
void assertion_handler(int)
{
  std::cerr << "Assertion failed." << std::endl;
}

--
Rainer Deyke (root_at_[hidden])
Shareware computer games           -           http://rainerdeyke.com
"In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor

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