const function arguments: style question
Posted on 2006-10-23
If I have a function like this:
void Function ( CMyClass& i )
and I intend to not modify the parameter i, it is a good idea to change the function to
void Function ( const CMyClass& i )
However, what if I am passing the parameter by value - is the const still necessary ? I mean, it only prevents against modifying the local copy of the parameter:
void Function ( const CMyClass i ) // overkill ?
Is it also good form to use const in this case, or just overkill ?