[Clam-devel] refactoring backends (2)

David García Garzón dgarcia at iua.upf.edu
Mon Jun 8 06:54:23 PDT 2009


Yes, that's just what CLAM_ASSERT does. Aborting in debug, throwing in 
release. The one that it is removed on release is the CLAM_DEBUG_ASSERT, and 
we don't recomend using it unless the overhead of the check is in a bottle 
neck.

CLAM asserts also provide backtrace dumping  (in linux) and programable 
handling callback. We had a callback that we used on graphical apps that 
showed a dialog before crashing but we removed it temporary because when the 
assert was done in the processing thread (within a Do) it could not access 
the gui thread safely. This is another one of the refactorings we should do 
on the backends: handling unhandled exceptions and failed assertions.

See the doxygen for more information:
http://clam-project.org/doc/CLAM-doxygen/Assert_8hxx.html

David.


On Monday 08 June 2009 15:08:42 dirk.griffioen wrote:
> Hi,
>
> Would clam be interested in the ENFORCE idiom? Basically these are
> asserts, but they are kept in release mode and throw(). The rationale
> you can find here: http://www.ddj.com/cpp/184403864
>
> I have found they lead to much smaller and safer code as for instance
> preconditions/invariants are 'enforced'.
>
> For example, before:
>
>
> and after (please note the example is not too good: destuctors should
> not throw ...)
>
>
>
> It generates errors like this:
>
>
>
> But this might be too much what CLAM_ASSERT already does ...
>
> Dirk
>
> PS - attached the header






More information about the clam-devel mailing list