Quote:
|
Originally Posted by Rickertsen2
Earlier today i was confounded with a mysterious bug in my php code. No matter what i did, i couldn't get it to work. After exhausting everything i could possibly think of, i spent another 15 minutes scouring the php manual thinking my bug might be due to an obscure security permissions issue. Well, it turns out I was uploading my code to the wrong server. I felt pretty dumb as i realized i fixed the bug half an hour ago.
------------------------------- edit ----------------------------------------
At regionals i had block of code like:
...
if(condition)
//do something
...
which i later changed to :
...
if(condition)
//do something
//do something else
without adding the brackets. I tend to do that often. In any case it caused out robot to automatically aim at people level and autofire/load until it ran out of balls
|
This is an EXTREMELY common mistake. In fact, most companies' coding standards require to use braces {} even if there is only one line of code in the code block. The reason for this standard is to aviod the bug you speak of. We mention this in our Advanced Programming presentation at the FIRST Robotics Conference that we presented last year (and will be presenting again at 3:00 tomorrow.
It's good that you finally caught it. I would definitely suggest always using braces.