Hi Scott,

Too late already but my 2 cents below :-)

On 27/07/2016 02:54, Scott Kostyshak wrote:
The attached patch constifies a function parameter. My question is
whether this patch causes more pain to other developers than it does
good to the code.

The patch modifies a header that is included in many of our .cpp files,
so will cause a significant amount of recompilation.

I think I will come across this scenario in the future so I am curious:
what are your preferences?

(1) Do not commit any part of the patch because it is so minor.

This is my preference because it doesn't bring anything and it can create confusion for the beginner when compared with const reference. The C++ beginner could be tempted to add a "&" here...

I think it was in the coding style document somewhere that POD parameter (except big structure of course) should be passed by copy.

Conclusion: I'd prefer the coding style to actually forbids this actually :-) The coding style should also say that function parameter shall not be changed in the function. Create your own local copy if you need it.

Thanks,
Abdel.

Reply via email to