|
Boost : |
From: Eugene Karpachov (jk_at_[hidden])
Date: 2001-03-16 01:59:27
Thu, Mar 15, 2001 at 10:45:15PM -0800, Jesse Jones ÐÉÛÅÔ:
> 2) CloseHandle can also fail, but you don't want to throw from a dtor so an
> assert might be good.
Is there any difference? Throwing from destructor has at worst case the same
effect as failed assertion; but assert usually disappears from release builds,
and throw's not.
> 6) It's better to provide an operator const void*() method instead of
> operator bool(). (Unlike bool the const void* one won't implicitly convert
> to umpteen different types).
For the same reason I'm against implicit conversions when there is no real
need for them; why not to provide just member function?
> 7) I don't think the locker classes should themselves throw exceptions. The
> only way to get this to happen is for the programmer to do something nasty
> like call unlock too many times. But this is a straight forward programmer
> error, not a runtime error, so it seems like an assert is the answer.
Assert is primarilly debug tool, and library cannot depend from mode it is
compiled - debug mode or release mode. It is what std::logic_error (as base
class) is for.
-- jk
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk