[Clam-devel] refactoring backends (2)

dirk.griffioen dirk.griffioen at barcelonamedia.org
Mon Jun 8 06:08:42 PDT 2009


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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.clam-project.org/pipermail/clam-devel-clam-project.org/attachments/20090608/69f0d240/attachment-0003.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: e1.png
Type: image/png
Size: 15580 bytes
Desc: not available
URL: <http://lists.clam-project.org/pipermail/clam-devel-clam-project.org/attachments/20090608/69f0d240/attachment-0009.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: e2.png
Type: image/png
Size: 14095 bytes
Desc: not available
URL: <http://lists.clam-project.org/pipermail/clam-devel-clam-project.org/attachments/20090608/69f0d240/attachment-0010.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: e3.png
Type: image/png
Size: 11763 bytes
Desc: not available
URL: <http://lists.clam-project.org/pipermail/clam-devel-clam-project.org/attachments/20090608/69f0d240/attachment-0011.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: enforce.hpp
Type: text/x-c++hdr
Size: 3792 bytes
Desc: not available
URL: <http://lists.clam-project.org/pipermail/clam-devel-clam-project.org/attachments/20090608/69f0d240/attachment-0003.hpp>


More information about the clam-devel mailing list