[petsc-dev] errors galore related to Barry's change to PetscError

Jed Brown jed at 59A2.org
Sat May 8 16:50:58 CDT 2010


On Sat, 8 May 2010 16:18:34 -0500, Barry Smith <bsmith at mcs.anl.gov> wrote:
> 
>   Sorry, and Jed thanks for fixing.
> 
>   Why there needs to be separate C++ functions indicates to me a
>   problem with the design. We should fix up the C one so that a C++
>   one is not needed that is separate.

It writes to a std::ostringstream.  I don't see that as a great
usability advantage, but it is different behavior.  Also, I'm unclear
about what PetscTraceBackErrorHandler(Cxx) is supposed to when it is
done.  As currently written, root writes the message and everyone else
waits 10 seconds, then abort()s.  Seems to me that non-root should wait,
then everyone should call MPI_Abort().  I don't know when it would be
acceptable to call abort() in parallel.

As for C++, why does C support need to be optional?  In other words,
what value is there in not defining PETSC_USE_EXTERN_CXX?  Seems to only
make error messages more obtuse and create a different ABI for no real
benefit.  As far as I know, there is nothing wrong with having mangled
and unmangled symbols with the same name, as in

  extern "C" PetscErrorCode VecNorm(Vec,NormType,PetscReal*);
  #if defined __cplusplus
  static inline PetscErrorCode VecNorm(Vec x,PetscReal *nrm) {return VecNorm(x,NORM_2,&nrm);}
  #endif


And why are things like petsclog.hh wrapped in

  #if defined(PETSC_CLANGUAGE_CXX) && !defined(PETSC_USE_EXTERN_CXX)

instead of

  #if defined(PETSC_CLANGUAGE_CXX) && defined(__cplusplus)


Jed



More information about the petsc-dev mailing list