> JMarc> I am a bit surprised by the following:
> JMarc> -Bullet::Bullet(const int f, const int c, const int s)
> JMarc> +Bullet::Bullet(int f, int c, int s)
> 
> Whoa! Aren't f, c and s passed by value here, so it makes no sense to declare
> them const anyway?

If you do

int foo(int const bar) {
        bar = 1; // Illegal
}

If you do

int foo(int bar) {
        bar = 1; // Legal
}

Such a thing makes sense in a few isolated cases. For instance,
the const-version can in a few lucky cases result in more optimized
code.
Also, if you use your own classes, there can be a difference between
const and non-const versions of the methods, but this is rare.
I seem to remember that it does happen in one situation in LyXFont.C,
but maybe that has been cleaned out.

In general, there's no need to do

int foo(int const bar) {

}

Greets,

Asger

Reply via email to