[<<][c][>>][..]
Sun Oct 14 09:25:39 EDT 2012

const * const

0. const * const: the first "const" refers to the object, the second
   to the poiter variable.

1. You'd want to declare "const *a" in the function PROTOTYPE to show
   the caller that the contents of an object passed by reference is
   not modified.

2. In general, you want variables in a function that are not to be
   changed to be declared "const".

3. You'd want to also use "const * const a" in a function DEFINITION
   to make sure the implementation doesn't modify the value of the
   pointer itself.  However, this doesn't need to show up in the
   prototype!  (Since pointers are passed by value it is irrelevant to
   the caller.)  The prototype can just be "const *a".

( #3 is the new insight )




[Reply][About]
[<<][c][>>][..]