[petsc-dev] not assert()s in PETSc source

Barry Smith bsmith at mcs.anl.gov
Sat Feb 9 16:59:06 CST 2013


   I've added to the PETSc style guide that assert() is not to be used in PETSc source code. I've also replaced all assert() usages in PETSc. 

   Instead of assert one should use things like

    if (something) SETERRQn(appropriate comm,PETSC_ERR_PLIB,"Format message",args);

   Barry

Asserts are not to be used because 

1) they don't play well in the parallel MPI world and

2) they do not print out enough useful information if triggered.





More information about the petsc-dev mailing list