[petsc-dev] declaring argument as const basic type in PETSc
Barry Smith
bsmith at mcs.anl.gov
Wed Aug 17 13:09:00 CDT 2011
Some declarations of the form
extern PetscErrorCode SAAddData(SA arr, const PetscInt len, const PetscInt *ia, const PetscScalar *wa, const PetscInt *ja);
have crept into PETSc. const PetscInt len
Do we want to have such beasties? What purpose do they serve?
My understanding is that it is contaminating the entire code (because of the extern PetscErrorCode SAAddData(SA arr, const PetscInt len, const PetscInt *ia, const PetscScalar *wa, const PetscInt *ja); with the knowledge that internally the subroutine never changes the value of the stack variable function which is the opposite of encapsulation. What am I missing? Is this just stupid C syntax, is there a better way?
Thanks
Barry
More information about the petsc-dev
mailing list