Allan Rae <[EMAIL PROTECTED]> writes:

| If you ignore the optimisation possibilities and look at it purely as info
| for other programmers -- making it obvious that it should never be
| necessary to change the values being passed.  They are const.

They are passed by value, and for PODs const or non-const makes no
difference. Adding the const qualifier will just be confusing.
For more complex objects like string passing by reference will be a
gain. You can pass as value if you want to, but then you will not be
taking advantage of the _significant_ optimization that pass by
reference gives.

|  If they
| were strings I would have used "string const &" but a "int const &" costs
| more than passing by value.  So I used "int const" to convey the
| information that the parameters are not changed -- having already applied
| the optimisation of passing the ints by value instead of by reference.
| 
| So IMO, Bullets.h is wrong and Bullets.C is right.

No.

btw. Did you notice that Bullets.C compiled without a warning? This
implies that foo(int) and foo(const int) practically have the same
qualification. Don't add confusion by using foo(const int).

        Lgb

Reply via email to