[petsc-dev] declaring argument as const basic type in PETSc

Jed Brown jedbrown at mcs.anl.gov
Wed Aug 17 13:37:33 CDT 2011


On Wed, Aug 17, 2011 at 11:34, Barry Smith <bsmith at mcs.anl.gov> wrote:

> But my question remains, should we const declare function arguments?


No, the prototype should never use const for stack arguments (pointer to
const is totally different and should be used anywhere that it is correct).

I don't know any responsible libraries that const-ify value parameters in
prototypes. I think it most commonly arises from ignorance of, or sloppiness
with, the actual semantics of the C language.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20110817/50a6fd5e/attachment.html>


More information about the petsc-dev mailing list