Debugging-Looking in the wrong places

This is a discussion on Debugging-Looking in the wrong places within the A Brief History of Cprogramming.com forums, part of the Community Boards category; Wow, I just spent about an hour trying to figure out what was wrong with my code. I kept looking ...

  1. #1
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972

    Debugging-Looking in the wrong places

    Wow, I just spent about an hour trying to figure out what was wrong with my code. I kept looking through all my classes because there was no way there was something wrong with the function since it was so simple...Turns out it was really simple:
    Code:
    for (int i=0;i<4;i++)
    {
    for (int i2=0;i<4;i++)
    {
    Yesss I'm never naming the second index of a nested loop anything close to the first one again
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  2. #2
    Registered User
    Join Date
    Jul 2003
    Posts
    450
    Having just read Code Complete one suggestion he makes is using more meaning full names for your index variables based on what they are used for. I think this would have helped in your case.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Debugging Dev C++
    By tuurb046 in forum Tech Board
    Replies: 10
    Last Post: 08-16-2007, 01:51 PM
  2. gdb no debugging symbols found
    By Laserve in forum Linux Programming
    Replies: 8
    Last Post: 09-17-2006, 09:56 AM
  3. debugging directx apps
    By confuted in forum C++ Programming
    Replies: 1
    Last Post: 08-16-2003, 09:56 AM
  4. God
    By datainjector in forum A Brief History of Cprogramming.com
    Replies: 746
    Last Post: 12-22-2002, 12:01 PM
  5. Debugging mode selection during compile time
    By YALINI in forum C Programming
    Replies: 1
    Last Post: 09-03-2001, 10:56 AM

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