Re: Signature inconsistency
Quote:
Neither one gives an error, or even so much as a warning. Why?
Because there can be no ambiguity, though I believe the opposite is more typically used: the parameter in the prototype is not declared const, but it is declared const in the implementation. The idea is that the user of the function does not care whether or not the parameter is const since either way due to pass by value it will not affect the caller's copy of the value. The implementor might care since it is a reminder that the value should not be modified.
Re: Signature inconsistency
Quote:
Originally Posted by laserlight
The idea is that the user of the function does not care whether or not the parameter is const since either way due to pass by value it will not affect the caller's copy of the value. The implementor might care since it is a reminder that the value should not be modified.
That's great except why does the compiler complain if compiling and linking are done in separate steps? Actually, I just discovered the Sun compiler complains, but not the gnu compiler. So it appears maybe this is an issue with the Sun compiler. That might also explain the inconsistency between debug and non-debug modes.
Re: Signature inconsistency
When passing by value, the const qualifier doesn't make a whole lot of difference. I wouldn't be surprised if different compilers handled that case differently.