When will I ever learn

Published July 26, 2004
Advertisement
I really should know by now not to add new arguments to a function with default parameters when refactoring my code. I'm just glad I'm paranoid with my asserts. That one would have been a pain to debug if the assert hadn't caught it.

Basically I took dodecahellspawn and began seperating game logic from any SDL dependencies, one of which was SDL_GetTicks(). So for a stopgap, I added an extra parameter to functions that used SDL_GetTicks() that was the current tick count. This unfortunately included a couple of functions that took default arguments. The bugger was that when called at the very beginning of program execution, it would have a tick count of 0, so the call stack looked reasonable at first. Sure, it took me only five minutes to figure out since I am paranoid with my asserts, but that's five minutes I could have saved if I had remembered my lessons from last time.

Hopefully now that I've taken the time to write about it, it will have sunken in for next time. I doubt it, but I can still hope.
Previous Entry Bad code here
Next Entry Hardware
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement

Latest Entries

New bug to me

1652 views

Week/Class 9

1505 views

Week/Class 8

1540 views

Week/Class 7

1592 views

The promised files

1816 views

Week/Class 6

1287 views

Week/Session 5

1342 views

Week/Session 4

1284 views

On the soapbox

1385 views

Week/Session 3

1260 views
Advertisement