[Merkaartor] Small speedup (const variables)

Roeland Douma unix at rullzer.com
Sat Jun 21 14:19:08 BST 2008


I have alway learned that const values are better. Also for maintaing it 
yourself since the compiler tells you when someting is overwritten 
(espessialy when you don't want it). But I do not maintain the code so 
ofcoures it is up to you guyz :)

I'll check the code for some pointers that can be made const and functions 
that can be marked static. As my contribution to the project :)

Roeland

On Saturday 21 June 2008 14:57:38 Dirk Stöcker wrote:
> 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





More information about the Merkaartor mailing list