Logical AND with false...
-
Didn't notice this little piece of code and it was making me think some sections worked completely different than they actually do.
//C++
if(m_Config.m_isContinuous && false){ //<- should have probably payed closer attention to that...
//A whole bunch of code that I thought was getting executed
}
else{
//What's actually getting executed
}Guess that was left like that for lack of time to clean up or something... but it shure led me astray... :doh:
-
Didn't notice this little piece of code and it was making me think some sections worked completely different than they actually do.
//C++
if(m_Config.m_isContinuous && false){ //<- should have probably payed closer attention to that...
//A whole bunch of code that I thought was getting executed
}
else{
//What's actually getting executed
}Guess that was left like that for lack of time to clean up or something... but it shure led me astray... :doh:
-
Didn't notice this little piece of code and it was making me think some sections worked completely different than they actually do.
//C++
if(m_Config.m_isContinuous && false){ //<- should have probably payed closer attention to that...
//A whole bunch of code that I thought was getting executed
}
else{
//What's actually getting executed
}Guess that was left like that for lack of time to clean up or something... but it shure led me astray... :doh:
That's sort of a way to (temporarily) comment-out the then-section for testing. It probably shouldn't have made it to production.
-
That's sort of a way to (temporarily) comment-out the then-section for testing. It probably shouldn't have made it to production.
Like Ryan said above... it totally faked me out... :)
-
That's sort of a way to (temporarily) comment-out the then-section for testing. It probably shouldn't have made it to production.
-
Didn't notice this little piece of code and it was making me think some sections worked completely different than they actually do.
//C++
if(m_Config.m_isContinuous && false){ //<- should have probably payed closer attention to that...
//A whole bunch of code that I thought was getting executed
}
else{
//What's actually getting executed
}Guess that was left like that for lack of time to clean up or something... but it shure led me astray... :doh:
-
Didn't notice this little piece of code and it was making me think some sections worked completely different than they actually do.
//C++
if(m_Config.m_isContinuous && false){ //<- should have probably payed closer attention to that...
//A whole bunch of code that I thought was getting executed
}
else{
//What's actually getting executed
}Guess that was left like that for lack of time to clean up or something... but it shure led me astray... :doh:
My (latest) compiler has a "dead code" checker. We currently have "Dead code (e.g. 'if (false)')" set as a Warning, but I would like to promote this to an Error. I like to say that the Compiler is a programmer's best friend, just make sure you don't put blinders on it or it can't help you. Personal Pet Peeve: initializing variables to 0 or null when you can safely initialize a few lines later.
-
That's sort of a way to (temporarily) comment-out the then-section for testing. It probably shouldn't have made it to production.
PIEBALDconsult wrote:
That's sort of a way to (temporarily) comment-out the then-section for testing. It probably shouldn't have made it to production.
It might actually be intended to stay in there until the developer's sure that the previous condition won't ever be used again...or the logic within the condition, which may be useful in a modified condition but might be difficult to remember. Sometimes it's easier to do that when you think your boss/customer/vendor has lost their mind than to trust that you'll remember exactly out of which source version you chopped it if you need it back NOW.
-
My (latest) compiler has a "dead code" checker. We currently have "Dead code (e.g. 'if (false)')" set as a Warning, but I would like to promote this to an Error. I like to say that the Compiler is a programmer's best friend, just make sure you don't put blinders on it or it can't help you. Personal Pet Peeve: initializing variables to 0 or null when you can safely initialize a few lines later.
englebart wrote:
Personal Pet Peeve: initializing variables to 0 or null when you can safely initialize a few lines later.
I'm sure somebody else' pet peeve is... "wait to initialize variable when you could've just done it with the declaration". Most C programmers do it that way...