Refactoring patches
Yuriy Skalko
yuriy.skalko at gmail.com
Sat Oct 17 05:16:06 UTC 2020
> It is not hard to add `const` again. But here is another important
> question -- consistency. If you look on any function in LyX with int or
> bool parameter, it will be without `const` and still is not modified
> inside the function in 99% cases. I think it is not worth to add it
> there and to leave here.
>
> Also I cannot remember the usage of `const` for value parameters in any
> common C++ library.
>
>
> I wouldn't know about that. But the same reasons to declare variables const would seem to apply here, no?
>
> Riki
Yes, they are similar.
Google C++ Style Guide
(https://google.github.io/styleguide/cppguide.html) says: "For a
function parameter passed by value, const has no effect on the caller,
thus is not recommended in function declarations."
And here is the case against it (linked from above guide):
https://abseil.io/tips/109
But people still have different opinions on it:
https://stackoverflow.com/questions/117293/use-of-const-for-function-parameters
Yuriy
More information about the lyx-devel
mailing list