[petsc-dev] When __FUNCT__ is wrong

Barry Smith bsmith at mcs.anl.gov
Fri Aug 27 12:45:46 CDT 2010


  Jed,

      You are certainly welcome to add it.

    Barry

On Aug 27, 2010, at 11:59 AM, Jed Brown wrote:

> C99 mandates __func__, but unfortunately C++ and earlier C standards
> mandate no such thing.  Even so, most compilers support __FUNCTION__,
> __PRETTY_FUNCTION__ (distinct in C++), or __func__.  Inaccurate traces
> annoy me greatly and it's inevitable that __FUNCT__ is occasionally
> incorrect.  It also seems a shame for traces to just say "USER provided
> function" when the compiler supports something better.  So how about
> having configure check for the existance of a compiler-supported name,
> and perhaps also add an assertion to PetscFunctionBegin to error if
> __FUNCT__ does not match __FUNCTION__ (and is defined to something other
> than "User provided function", so that this wouldn't break user code
> that ignores __FUNCT__ entirely).
> 
> Jed




More information about the petsc-dev mailing list