[petsc-users] error check in C++ constructor

Matthew Knepley knepley at gmail.com
Tue Feb 2 17:08:11 CST 2010


You can use CHKERRXX().

  Matt

On Tue, Feb 2, 2010 at 5:00 PM, Umut Tabak <u.tabak at tudelft.nl> wrote:

> Dear all,
>
> I was looking at some code C++ constructor code where some PETSc Vec's are
> created in the constructor, the problem/question is that constructor does
> not have a return type and CHKERRQ is a replacement for a macro code which
> returns a value, that is the error code.
>
> I guess, the safest bet to check for errors in a constructor is to compare
> the return value from PETSc functions with 0 and issue an error message from
> the constructor, is this reasoning right?
>
> Best regards,
> Umut
>



-- 
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-users/attachments/20100202/70708c5c/attachment.htm>


More information about the petsc-users mailing list