Programing superstition

Posts 14 of 4 · Page 1 of 1
Programing superstition
Sometimes when I'm working on a project I do things like this:

Code:
while( true ){
...
...
    // just in case :D
if( foo-- <= 0 ){

}
}
Although it's impossible for integer 'foo' to just skip a value(ie. in a loop) I always check to see if it's equal to or less then <number here> even if it's impossible for foo to be anything lower then that number. I feel much safer when I do it like this.

Sounds familiar? Or do you do something like this?
ASSERT(foo-- <= 0);

yay for debug builds :P
We never know.. we never know.. Yep same crap happens to me aswell.
Perhaps we should start the first religion for programmers we all know that foo can't skip a step in a loop and yet there is something...
Posts 14 of 4 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?