Benefits of using "const" with scalar type? (e.g. "const double" or "const int")
<pre><code>///////////////////////////////////////
class A {
    ...
    const double funA(void)
    {...}
};

A a;
double x = a.funA(); 
// although the intention is to
// enforce the return value to be const and cannot be
// modified, it has little effect in the real world.

class A2 {
    ...
    double funB(void)
    {...}
};

///////////////////////////////////////
class A {
    void setA(const double d)
    { // now you cannot change the value of d, so what?
      // From my point of view, it is NOT a good practice to change the pass-in parameter
      // in this case, unless you want the caller to receive that change
      // instead, you can do 
      // const double dPassIn = d;
      / /then use dPassIn instead.
      ...
    }
};

class A2 {
    void setB(double d)
    {...}
};

//////////////////////////////////////
</code></pre>

<p>From my understanding, we should prefer to 
using <code>A2::funB</code> and <code>A2::setB</code> because the <strong>const</strong> used in
both <code>A::funA</code> and <code>A::setA</code> has little meaning.</p>

<p>// Update //</p>

<pre><code>    FMOD_RESULT F_API EventSystem::getReverbPresetByIndex(const int index, 
                                FMOD_REVERB_PROPERTIES *props, char **name = 0);
</code></pre>

<p>I consider FMOD is a well-designed package and it does use <code>const int</code> inside function parameter list.
Now, I agree that the <code>A::setA(const double d)</code> has its edge.</p>
