Boost logo

Boost :

From: Darren Cook (darren_at_[hidden])
Date: 2003-05-08 06:13:50


> Under win32, my assert method uses
>
> if (IsDebuggerPresent())
> {
> DebugBreak(); // ammounts to int 3 on intel
> }

Maybe that is the 4th alternative I couldn't think of earlier :-). I also
thought of one more: emailling the system administrator. Useful on servers.

> which I find better than the debugger catching an exception. At my last
> work place, we made asserts through exceptions but ended up with
> exceptions being thrown in destructors and such which wasn't very nice,
> especially if the destructor was being called during clean up because of
> a previous exception.

I hadn't thought of such issues. Is uncaught_exception() implemented in all
modern compilers? Falling back on one of the other methods when it returns
true instead of throwing an exception avoids some of the problems.

Darren


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