Thread: Problem with vector iterator

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Programming Ninja In-T...
    Join Date
    May 2009
    Posts
    827
    Quote Originally Posted by grumpy View Post
    Not true.

    A segmentation violation is a common symptom of undefined behaviour (typically due to your program modifying memory it shouldn't).

    More often than not, code which causes undefined behaviour is distinct from code where the symptoms are detected. Adding or removing a line, and having symptoms disappear, therefore often indicates that some code BEFORE the offending line is the cause of the problem.

    All you are doing by commenting out that particular line is removing the code where the symptoms become visible. You are not affecting the cause of the problem.
    You are right. However, I really meant that that line is the entry point for understanding the problem, i.e. you read that line, and that gives you the information on where to proceed from there.
    I was trying to get everyone to focus on that line to start with, thus the reason for those earlier words.

    I've learned that sometimes making untrue statements helps all those involved reach the real truth of a matter. Has something to do with the way our brains think...

    Btw, I read up on segfaults before even starting this thread, but still did not spot the problem. I didn't realize it was the fault of the < operator of the S_browser struct.
    Indeed. You have demonstrated laziness in this thread in more ways that assuming untested code is valid.
    I wont dispute that point. lol
    Last edited by Programmer_P; 01-04-2013 at 06:26 PM.
    I'm an alien from another world. Planet Earth is only my vacation home, and I'm not liking it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem using a vector iterator in a loop.
    By M.Richard Tober in forum C++ Programming
    Replies: 6
    Last Post: 10-29-2011, 01:53 PM
  2. vector and iterator problem
    By BeBu in forum C++ Programming
    Replies: 10
    Last Post: 03-11-2009, 07:38 AM
  3. Vector Iterator Help
    By (TNT) in forum C++ Programming
    Replies: 5
    Last Post: 11-04-2007, 02:53 PM
  4. vector<object>::iterator Help
    By The Brain in forum C++ Programming
    Replies: 16
    Last Post: 03-26-2006, 07:22 PM
  5. Iterator _ erasing from a vector help
    By Hexxx in forum C++ Programming
    Replies: 1
    Last Post: 03-22-2006, 07:43 PM