[Merkaartor] Small speedup (const variables)
Dirk Stöcker
openstreetmap at dstoecker.de
Sat Jun 21 13:57:38 BST 2008
On Sat, 21 Jun 2008, Roeland Douma wrote:
> I was looking trough the svn code today. And I noticed some variables that
> could be made const. This is always nice since the compiler can then do some
> more optimalisation. I have tested them myself and did not notice anny odd
> behavoir. I'll check some more code when I get back home this afternoon.
I don't think any of you changes really affects the code. But on the other
hand it makes maintaining harder, as having local variables const means
usually there is a real reason to have them const. Rather then removing
the const in the future when required by code changes a copy of the
variable to another local variable will be the result to be sure and
that's bad in terms of code quality in any case.
Making pointers const, when the functions is not modifying the code
would be much better. This can reduce maintenance problems a lot. Or
making pass by value of structures into pass by const reference is a good
optimization.
BTW: the two "static"s should be added nevertheless. This removes
superflous code.
Ciao
--
http://www.dstoecker.eu/ (PGP key available)
More information about the Merkaartor
mailing list