Thread: I upgraded to g++ 4.2.2 and...

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    It's not particular to iterators, though. In fact, it's this way with iterators because it's already this way with pointers. Comparing invalid pointers for equality is undefined.

    And the reason for that is that there is, or might be, or has been, hardware which traps upon such reads.

    There's simply no use in comparing invalid pointers, especially not to themselves, so what's the point in requiring it to have a defined result?
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  2. #2
    Use this: dudeomanodude's Avatar
    Join Date
    Jan 2008
    Location
    Hampton, VA
    Posts
    391
    There's simply no use in comparing invalid pointers, especially not to themselves, so what's the point in requiring it to have a defined result?
    I agree. You can compare an orange to itself, but once you're dealing with bananas, who cares about oranges?
    Ubuntu Desktop
    GCC/G++
    Geany (for quick projects)
    Anjuta (for larger things)

  3. #3
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Quote Originally Posted by dudeomanodude View Post
    I agree. You can compare an orange to itself, but once you're dealing with bananas, who cares about oranges?
    Not necessarily true. I may want to compare different iterators for positioning purposes for instance. Or a reverse and forward iterator on the same object.

    I think the argument is, there's no point in comparing invalid iterators.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

Popular pages Recent additions subscribe to a feed