[petsc-dev] Fwd: SACUDA - Cannot compile
Satish Balay
balay at mcs.anl.gov
Wed Oct 27 17:24:13 CDT 2010
Ok - perhaps we can simulate current behavior with:
typedef char* VecType;
typedef const char* ConstVecType;
and use VecType/ConstVecType as needed in code?
Satish
On Wed, 27 Oct 2010, Barry Smith wrote:
>
> Satish,
>
> We already had this fight and this change lost. Making this change means that one can never build a VecType on the fly, so all VecType must be declared at compile time which defeats the entire purpose of PETSc.
>
> I don't understand why "const" is scoped differently for a macro than for the typedef." but it seems to me an annoying feature of C.
>
> Barry
>
>
> On Oct 27, 2010, at 5:08 PM, Satish Balay wrote:
>
> > On Wed, 27 Oct 2010, Barry Smith wrote:
> >
> >>
> >> On Oct 27, 2010, at 4:48 PM, Jed Brown wrote:
> >>
> >>> On Wed, Oct 27, 2010 at 17:45, Barry Smith <bsmith at mcs.anl.gov> wrote:
> >>> hmm, is there any reason we can't/shouldn't use a typedef for our VecType (and its many friends)?
> >>>
> >>> I think the issue is because "const" is scoped differently for a macro than for the typedef.
> >>>
> >>> typedef char *Foo;
> >>>
> >>> now "const Foo" means "char *const" instead of "const char *".
> >>
> >> Damn, damn, damn, damn,
> >
> > -#define VecType char*
> > +typedef const char* VecType;
> >
> > -EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecGetType(Vec, const VecType *);
> > +EXTERN PetscErrorCode PETSCVEC_DLLEXPORT VecGetType(Vec, VecType *);
> >
> > The above type of change [i.e 'const VecType' to 'VecType'] gets
> > src/vec/vec/interface sources compiled..
> >
> > Satish
>
>
More information about the petsc-dev
mailing list