[petsc-dev] Preprocessor hell: #define VecType

Karl Rupp rupp at mcs.anl.gov
Fri Sep 28 11:59:01 CDT 2012


Hi,

> You are missing the fact that all PetscObjects have an implementation
> type and it is a string, and there is
> one of these #defines for every class.

Ok, thanks for shedding light on that.

> However, I would support namespacing all these Types since they are not
> in heavy use, e.g. PetscVecType, PetscMatType.

I assume that any compiler errors would be a LOT clearer if VecType were 
at least a typedef instead of a brutal preprocessor-define. Without 
having checked the following,
  #define VecType PetscVecType
  typedef char* PetscVecType;
may already improve the situation substantially. Removing any 
preprocessor activity on the string/type 'VecType' would be the cleaner 
approach, though...

Best regards,
Karli




More information about the petsc-dev mailing list