Vector out of range program crash.

This is a discussion on Vector out of range program crash. within the C++ Programming forums, part of the General Programming Boards category; Here is the line of code bolded and the function that produces the errors. Code: void Player::draw(int hand_index, Deck * ...

  1. #1
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    964

    Vector out of range program crash.

    Here is the line of code bolded and the function that produces the errors.
    Code:
    void Player::draw(int hand_index, Deck * deck, int number)
    {
    	for(int loop = 0; loop < number; loop++)
    	{
    		/* place card in player's hand */
    		m_player_hands[hand_index].m_card_list.push_back(deck->m_cards.back());
    
    		/* hide all dealer cards except for the first one */
    		if (m_player_id == 0 && loop != 0)
    		{
    			m_player_hands[0].m_card_list[loop].flip_card(false);
    		}
    		/* remove card from deck */
    		deck->m_cards.pop_back();
    	}
    }

    Here is the state of all my watch variables during runtime

    Code:
    -		deck	0x00359ab8 {m_cards=[52]({m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...},{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...},{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...},{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hear 	Deck *
    -		m_cards	[52]({m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...},{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...},{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...},{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...},...,...)	std::vector<Card,std::allocator<Card> >
    +		[0]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[1]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[2]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[3]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[4]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[5]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[6]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[7]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[8]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[9]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[10]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[11]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[12]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[13]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[14]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[15]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[16]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[17]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[18]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[19]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[20]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[21]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[22]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[23]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[24]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[25]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[26]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[27]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[28]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[29]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[30]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[31]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[32]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[33]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[34]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[35]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[36]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[37]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[38]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[39]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[40]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[41]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[42]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[43]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[44]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[45]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[46]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[47]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[48]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[49]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[50]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[51]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    -		deck->m_cards	[52]({m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...},{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...},{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...},{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...},...,...)	std::vector<Card,std::allocator<Card> >
    +		[0]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[1]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[2]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[3]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[4]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[5]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[6]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[7]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[8]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[9]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[10]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[11]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[12]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[13]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[14]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[15]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[16]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[17]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[18]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[19]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[20]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[21]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[22]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[23]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[24]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[25]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[26]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[27]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[28]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[29]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[30]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[31]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[32]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[33]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[34]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[35]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[36]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[37]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[38]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[39]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[40]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[41]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[42]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[43]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[44]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[45]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[46]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[47]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[48]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[49]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[50]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    +		[51]	{m_suit=-858993460 m_value=-858993460 suits_lookup=[4]("Clubs","Diamonds","Hearts","Spades") ...}	Card
    		hand_index	0	int
    		loop	0	int
    		m_player_hands	[0]()	std::vector<Hand,std::allocator<Hand> >
    		number	2	int
    -		this	0x00359b90 {m_player_id=0 m_cash=100 m_active_hand=0 ...}	Player * const
    		m_player_id	0	int
    		m_cash	100	int
    		m_active_hand	0	int
    		m_bets	[0]()	std::vector<int,std::allocator<int> >
    		m_player_hands	[0]()	std::vector<Hand,std::allocator<Hand> >
    Hopefully that information shows up correctly, anyways, I can't see any variables that should cause me to access an out of range element?
    Sometimes I forget what I am doing when I enter a room, actually, quite often.

  2. #2
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    964
    By the way, here is how I create my hands, is this bad?
    Code:
    void Player::new_hand()
    {
    	Hand new_hand;
    	m_player_hands.push_back(new_hand);
    }
    Here is where I initialize everything:
    Code:
    void Play_State::init(Card_Game * game)
    {
    	if (game->m_betting_toggle == false)
    	{
    		// init Players
    		Player player0(0);
    		Player player1(1);
    		game->m_players.push_back(player0);
    		game->m_players.push_back(player1);
    		// init hands
    		game->m_players[0].new_hand();
    		game->m_players[1].new_hand();
    
    	}
    	// init Deck
    	game->m_deck = new Deck;
    	// shuffle deck
    	game->m_deck->shuffle_deck();
    	// draw cards for players
    	game->m_players[0].draw(0, game->m_deck, 2);
    	game->m_players[1].draw(game->m_players[1].m_active_hand, game->m_deck, 2);
    
    }
    Sometimes I forget what I am doing when I enter a room, actually, quite often.

  3. #3
    Unregistered User
    Join Date
    Sep 2005
    Location
    Antarctica
    Posts
    341
    are you sure that hand_index is a valid index into the vector? Also, your way of creating a hand is ok as long as you have a copy constructor. I would consider using pointers instead of stack objects though.
    -- Rocky
    -- DreamSys Software (http://www.dreamsyssoft.com)
    -- Free Tiff 2 PDF Library (http://www.dreamsyssoft.com/tiff-to-pdf-api)

  4. #4
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    964
    No I don't have a copy constructor actually. If you look at the runtime variables you'll see that hand_index is set to 0, and m_player_hands should have 1 hand in it because I called new_hand() for that player.

    Do you think it would solve the problem if I created the hand with new and made a pointer vector for it?
    Sometimes I forget what I am doing when I enter a room, actually, quite often.

  5. #5
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by Shamino View Post
    Do you think it would solve the problem if I created the hand with new and made a pointer vector for it?
    No, I doubt that would make a difference.

    Try using:
    Code:
    m_player_hands.at(hand_index).m_card_list.push_back(deck->m_cards.back());
    The vector::at() funtion will throw an out_of_bounds exception if the index doesn't exist. That way you can catch the exception and log a bit of info about what caused it. That should help you debug it.

  6. #6
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    964
    "Runtime was terminated in an unusual way"

    Thanks ambiguous error number 143534515

    Okay, so obviously there is no hand?
    Sometimes I forget what I am doing when I enter a room, actually, quite often.

  7. #7
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    964
    Fixed problem:

    Code:
    void Betting_State::init(Card_Game * game)
    {
    	// init betting switches
    	m_enough_cash = true;
    	m_under_minimum_bet = false;
    	// init Players
    	Player player0(0);
    	Player player1(1);
    	game->m_players.push_back(player0);
    	game->m_players.push_back(player1);	
    	// init hands
    	game->m_players[0].new_hand();
    	game->m_players[1].new_hand();
    
    }
    Before I was calling player0 and player1 seperately to create a new hand and not giong through the game engine or even the vector they existed in.

    But I just found some more runtime errors, time to do some more debugging, oh sigh.

    Note to self: variables that are initialized within function brackets DISAPPEAR unless you push them into a vector!
    Last edited by Shamino; 01-18-2008 at 01:24 PM.
    Sometimes I forget what I am doing when I enter a room, actually, quite often.

  8. #8
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    22,901
    Don't sigh, finding errors is exciting
    It's fun to find out what the heck is wrong and finding out why it's wrong, but solving it isn't always fun when you have to redo your design.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  9. #9
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    964
    Quote Originally Posted by Elysia View Post
    Don't sigh, finding errors is exciting
    It's fun to find out what the heck is wrong and finding out why it's wrong, but solving it isn't always fun when you have to redo your design.
    All these errors are a result of me switching from a single hand pointer in a player class to having a hand container in each player class to support multiple hands.

    It required me to change alot of my game logic functions, so now they're all breaking haha. Basiaclly anything that used the hand class (almost ALL game logic functions) had to be suited up for multiple hand possibility.

    What's a blackjack game if you can't split your hand yknow?
    Sometimes I forget what I am doing when I enter a room, actually, quite often.

  10. #10
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by Elysia View Post
    Don't sigh, finding errors is exciting
    Well then you'd have LOTS of fun at my company!

  11. #11
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by Elysia View Post
    Don't sigh, finding errors is exciting
    Or when you spend 2-3 weeks trying to understand some code that was written by some third party, where every ten calls or so to some function about 15 levels down from your actual code "does the wrong thing", without actually having much clue about the code that the third party provided. I don't have to fix the bugs, I just have to prove that it's in the third party code - which in itself isn't always that easy.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  12. #12
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    22,901
    That's an entirely different story, though.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem using structures (they crash my program)
    By shadow1515 in forum C Programming
    Replies: 7
    Last Post: 06-17-2008, 09:36 AM
  2. sprintf() giving crash to program!!
    By maven in forum C Programming
    Replies: 4
    Last Post: 01-01-2006, 12:26 PM
  3. Filling a 2d Array cause program to crash
    By Geo-Fry in forum C++ Programming
    Replies: 2
    Last Post: 05-22-2003, 08:00 AM
  4. Trying to make rand different per program run
    By Dreamerv3 in forum C++ Programming
    Replies: 6
    Last Post: 01-18-2002, 03:26 AM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 11:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21