Bug in documentation for SETERRQ

Matthew Knepley knepley at gmail.com
Fri Aug 10 17:46:59 CDT 2007


On 8/10/07, John R. Wicks <jwicks at cs.brown.edu> wrote:
> SETERRQ is documented to not return a value:
> Synopsis:
> void SETERRQ(PetscErrorCode errorcode,char *message)

I have corrected this documentation.

> but it is defined in petscerror.h in terms of a return statement:
>
> #define SETERRQ(n,s)              {return
> PetscError(__LINE__,__FUNCT__,__FILE__,__SDIR__,n,1,s);}
>
> which causes a compilation error when it is called in a C++
> constructor/destructor, for example.
>
> A truly void error check, such as:

This does not make sense, unfortunately. SETERRQ is a C exception
and thus returns as a matter of definition.

  Thanks,

    Matt

> #define ckPetscErr(n, s) {if(0!=n)
> PetscError(__LINE__,__FUNCT__,__FILE__,__SDIR__,n,1,s);}
>
> or:
>
> #define ckPetscErr(stmnt, s) {PetscErrorCode ierr=stmnt;if(0!=ierr)
> PetscError(__LINE__,__FUNCT__,__FILE__,__SDIR__,ierr,1,s);}
>
> would be helpful.
>
>


-- 
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




More information about the petsc-users mailing list