Boost logo

Boost :

From: Aleksey Gurtovoy (alexy_at_[hidden])
Date: 2001-03-20 18:13:22


Steve Cleary wrote:
> Agreed; exceptions are better for unforseeable run-time
> errors; asserts are more suited for double-checking invariants.
> I've tried several different Win32 API return value checking
> methods, and the one that I settled on is simply:
> if (!EmptyClipboard())
> Win32_error::raise("CloseClipboard");
> where Win32_error is a class I've defined whose static member function
> "raise" will throw an exception of that type.
>
> Unexpected errors are propogated up the stack, and at the
> topmost level (in WinMain), I just have a catch for std::exception which
prints
> the message as a fatal error and (cleanly) shuts down.

As for me, I for sure don't want the application and even the document I am
editing to be closed just because 'Ctrl-C' for some reason did not place
anything into clipboard buffer ;).

Aleksey


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