Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » Interesting advantage of using indices instead of iterators
Re: Interesting advantage of using indices instead of iterators [message #7616 is a reply to message #7615] Wed, 10 January 2007 12:24 Go to previous messageGo to previous message
Balage is currently offline  Balage
Messages: 17
Registered: December 2006
Promising Member
I've also read a lot about this. It's not just iterators.

Many newcomers (including myself at that time) try to use pointer arithmetic to save that addition on array indexing inside loops. But they all fail to realize, that the compiler can do way much better optimizations if it knows what is just read from memory, and what is updated (and also when). Pointer arithmetic makes it a lot harder to figure that out, as the compiler cannot easily track where a pointer currently points to.
With regular array indexing, it exactly knows what element, when, and how is being accessed, and that's very good for optimization.

[Updated on: Wed, 10 January 2007 12:30]

Report message to a moderator

 
Read Message
Read Message
Read Message
Previous Topic: OSes: request for "advertising" audit
Next Topic: Funny way how to get thread specific id
Goto Forum:
  


Current Time: Fri Jun 27 17:15:35 CEST 2025

Total time taken to generate the page: 0.03753 seconds