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

Umut Tabak u.tabak at tudelft.nl
Tue Feb 2 17:00:56 CST 2010

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,

More information about the petsc-users mailing list