since developing object oriented software is so cumbersome in C and we are all resistent to doing it in C++

Jed Brown jed at
Sun Dec 6 09:43:24 CST 2009

On Sat, 5 Dec 2009 14:23:45 -0600, Matthew Knepley <knepley at> wrote:
> We do impose some of our process on users already, such as CHKERRQ and
> PetscMalloc.

CHKERRQ is still optional, it's just recommended in order to get a
decent trace.  It can't be used, for example, for top-level calls within
my VisIt plugin because those functions necessarily return something
else (I have an alternative which checks the return code, generates
debugging messages, possibly tries to deallocate local resources, and
throws the appropriate exception).  In C99 projects, I use an alternate
macro that uses __func__ instead of __FUNCT__.

There is PetscMallocSet if the user doesn't want to use PetscMalloc, but
users are rarely required to directly interact with
PetscMalloc/PetscFree anyway since most arrays are copied or managed by
an object.


More information about the petsc-dev mailing list