<p>How far do you go with <code>const</code>?  Do you just make functions <code>const</code> when necessary or do you go the whole hog and use it everywhere?  For example, imagine a simple mutator that takes a single boolean parameter:</p>

<pre><code>void SetValue(const bool b) { my_val_ = b; }
</code></pre>

<p>Is that <code>const</code> actually useful?  Personally I opt to use it extensively, including parameters, but in this case I wonder if it's worthwhile?</p>

<p>I was also surprised to learn that you can omit <code>const</code> from parameters in a function declaration but can include it in the function definition, e.g.:</p>

<p><strong>.h file</strong></p>

<pre><code>void func(int n, long l);
</code></pre>

<p><strong>.cpp file</strong></p>

<pre><code>void func(const int n, const long l)
</code></pre>

<p>Is there a reason for this? It seems a little unusual to me.</p>

The reason is that
```
const
```
for the parameter only applies locally within the function, since it is working on a copy of the data. This means the function signature is really the same anyways. It's probably bad style to do this a lot though.
I personally tend to not use
```
const
```
except for reference and pointer parameters. For copied objects it doesn't really matter, although it can be safer as it signals intent within the function. It's really a judgement call. I do tend to use
```
const_iterator
```
though when looping on something and I don't intend on modifying it, so I guess to each his own, as long as
```
const
```
correctness for reference types is rigorously maintained.