Darren Cook wrote:

In my own assert library I added options for logging, but in the end never used that and always had it throw an exception. This is nice for two reasons:
1. MFC debugger catches it and allows me to go back up the call stack to where the assert happened. (I'm still struggling with gdb but I think it can be set to do the same?)



Under win32, my assert method uses


if (IsDebuggerPresent())
{
        DebugBreak();   // ammounts to int 3 on intel
}

(IsDebuggerPresent() is a win32 method to see if a debugger is attached to the process)

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.

But I don't know if this can be applied to all platforms.

Russell


_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to