[petsc-dev] CHKERRXX() to propagate errors from C

Aron Ahmadia aron.ahmadia at kaust.edu.sa
Wed Oct 19 15:00:05 CDT 2011


Matt,

The only serious defense of exceptions I know of is that you can use them to
avoid the boilerplate you guys use heavily throughout your source
(CHKERRQ/SETERRQ).  As long as you remain committed to the boilerplate, I
can't think of anything that exceptions grant you in C style code.  As Barry
notes, they can be used to try and handle things in
constructors/destructors, but they are very dangerous in those methods and
only work when every data member can clean itself up (see:
http://www.parashift.com/c++-faq-lite/exceptions.html#faq-17.10)

-A
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20111019/a1548740/attachment.html>


More information about the petsc-dev mailing list