[petsc-dev] declaring argument as const basic type in PETSc
Chetan Jhurani
chetan.jhurani at gmail.com
Wed Aug 17 14:50:34 CDT 2011
I never meant to say that one must put const ints in the
declaration. Whether it is there or not, the caller is not
affected.
My point was const ints are useful on the developer side.
GNU Scientific Library and Intel and MKL use const ints for
CBLAS function declarations. Hadn’t noticed it earlier.
I’ve seen it being used in professional closed source code.
People stumble upon this idea unintentionally (because it
has been working silently for a long time and not all
compilers warn). And then some like it and some don’t.
Chetan
From: petsc-dev-bounces at mcs.anl.gov [mailto:petsc-dev-bounces at mcs.anl.gov] On Behalf Of Jed Brown
Sent: Wednesday, August 17, 2011 1:32 PM
To: For users of the development version of PETSc
Subject: Re: [petsc-dev] declaring argument as const basic type in PETSc
On Wed, Aug 17, 2011 at 12:29, Chetan Jhurani <chetan.jhurani at gmail.com> wrote:
can be avoided by putting const int in declaration
as well.
Right, but doing this is nonsense because it puts implementation details in a public header, the "anti-encapsulation". Just don't use const for value parameters.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20110817/d56b5779/attachment.html>
More information about the petsc-dev
mailing list