On Wed, Oct 19, 2011 at 8:02 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
> On Wed, Oct 19, 2011 at 14:57, Matthew Knepley <knepley at gmail.com> wrote: > >> The properly manage the clean up of partially created objects etc don't >>> they, which our C approach cannot handle. Not that I'm advocating for using >>> them or not. >> >> >> Hmm, I do not see how. As far as I know, you need logic to do that once >> you catch them, which we could also put in. >> > > Destructors for any live automatic (stack) allocated are called when an > exception is raised. Of course it causes all manner of havoc if any of these > destructors fail, but having them called means that you can use RAII and > "simply" have code that can unwind cleanly. That control flow is much harder > with return codes because you end up with either lots of gotos to unwind > from each place that can fail or deeply nested control structures. > Aren't all those destructors called on return too? Matt -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20111019/52fef1bc/attachment.html>
