[petsc-dev] Preprocessor hell: #define VecType

Barry Smith bsmith at mcs.anl.gov
Sat Sep 29 23:27:00 CDT 2012


On Sep 29, 2012, at 9:08 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:

> On Sat, Sep 29, 2012 at 12:20 PM, Dmitry Karpeev <karpeev at mcs.anl.gov> wrote:
> > ^^^ Note that this const is superfluous.
> Why is it superfluous?  Isn't the second argument type const char* const this way?
> 
> It's superfluous for the same reason we don't "set" by passing "const PetscInt". The const is irrelevant to the caller. All it means is that the implementation doesn't change the *its* copy (pass by value) and even that isn't type checked with respect to the public declaration. It's just clutter and suggests that the person who wrote it doesn't understand types.

  Which clearly I don't :-(

   So do we just go with typedef const char* VecType   and then all signatures are  VecType?




More information about the petsc-dev mailing list