|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: Stupidest Programming Mistakes
Quote:
Code:
#ifdef //This is actually a comment block, #1 code code code #endif //This is the end of comment block #1 |
|
#2
|
||||
|
||||
|
Re: Stupidest Programming Mistakes
The C Programing language has MANY different "issues" with undefined behavior or easy-to-make mistakes that compilers won't usually catch.
This website has compiled 10 (actually more than 10) common mistakes, check it out. |
|
#3
|
|||
|
|||
|
Re: Stupidest Programming Mistakes
My teammate made a great slipup that him and a mentor didn't catch till I looked. Here it is (with the error) in a function for averaging something in pseudocode.
Code:
int sum,count;
while(stuff_left)
{
sum+=stuff;
count++;
}
if(!count == 0)
return -1
else
return sum/count;
|
|
#4
|
|||
|
|||
|
Re: Stupidest Programming Mistakes
I dunno if this is truly a programming mistake... but testing autonomous (using PID) we forgot to plug in one of the the interrupt pins on the encoders, resulting in a very interesting open-loop control system, and various material damages (the robot LED, the green light, the 6' stack of books the light was sitting on, the desk the books were sitting on, the counter with microscopes behind the desk with the books and light, and my self confidence).
|
|
#5
|
||||
|
||||
|
Re: Stupidest Programming Mistakes
I had this:
Code:
auto_mode = ~auto_select1 + 2(~auto_select2) + 3(~auto_select3); Can someone spot the error there? Yeah, 2() is not a valid method. So I changed it to this: Code:
auto_mode = ~auto_select1 + 2*(~auto_select2) + 3*(~auto_select3); In another one we had: Code:
printf("Some motor values %d %d %d", 1,2,3);//Whatever
Thank goodness for Java. Paul Dennis |
|
#6
|
|||
|
|||
|
Re: Stupidest Programming Mistakes
How about spending an hour trying to decipher a run-time error and systematically commenting all of our added code up to that point, only to later find we were compiling with the 2005 FRC settings instead of 2006?
Oh, and this isn't really a programming error, but I still think it's up there as stupid. In our third or fourth practice match last year, our robot suddenly started smoking out on the field. We had used a large ribbon cable to wire the camera and dozens of switches throughout the robot for use in autonomous mode to sense and pick up tetras, and cap them, which had been working perfectly. As it turns out, several of the spare wires, which was about half of the cable, that had been cut off from removed sensors and never removed from the electronics, and that included several five volts and grounds, had brushed up against the frame, which, simply put, melted the entire cable and fried our camera. |
|
#7
|
|||
|
|||
|
Re: Stupidest Programming Mistakes
I decided to make life easier and write functions, and reuse them through out the program... Last night I spent 2 hours trying to figure out what was wrong with the functions, later I discovered that I forgot to include them in the user_routines.c
|
|
#8
|
||||
|
||||
|
Re: Stupidest Programming Mistakes
While one of our programmers was cleaning up the code, he accidentally deleted a line that said *DO NOT DELETE THIS LINE*. Well anyways it gave us quite a few headaches in Milwaukee.
|
|
#9
|
|||||
|
|||||
|
Re: Stupidest Programming Mistakes
Quote:
|
|
#10
|
||||
|
||||
|
Re: Stupidest Programming Mistakes
Quote:
That's why you always save a copy of the default code. |
|
#11
|
|||
|
|||
|
Re: Stupidest Programming Mistakes
Was working on the Marine Biology Study for AP Computer Science AB, and had was running through making a fish (was easy after the first 5 or 6 we made).
All of a sudden, STACK OVERFLOW? What in the world? isolated it to a method that returned a class variable, myID. That method was one line, it couldn't be the issue. Lo and behold, it was pointed out: public int myID() { return myID(); } ![]() |
|
#12
|
||||
|
||||
|
Re: Stupidest Programming Mistakes
This isnt as stupid as it was an accident but I'm still not going to mention the guy who wrote it:
We had a winch system that would connect to our drive motors. The point was to engage the winch when the cable was taken off the robot and hooked on the bar (2 years ago). Well, he engaged the winch during autonomous and the aircraft cable (which doesnt break) was wraped around the frame of the robot and the dead reckoning code simply drove the motors. The cable just got tighter and tighter. Needless to say the 1/2 inch steel tubing was a little bent and the entire frame looked like a car wreck. Thats when we decided that only one guy should make the programming mistakes. |
|
#13
|
||||
|
||||
|
Re: Stupidest Programming Mistakes
Hehehe, of course semicolons r an issue.
The biggest mistake was working on autonomous. It was at nationals and I still dont know what I did wrong but fixed it. As soon as autonomous started the bot drove forward then started spinning to the left firing into the crowds, judges, everywhere else. |
|
#14
|
|||||
|
|||||
|
Re: Stupidest Programming Mistakes
One stupid mistake I made at one point was that I forgot to close something off. I was too lazy to go back and look for it, so I just added a random "}" at the end of the code. Problem fixed!
![]() |
|
#15
|
||||
|
||||
|
Re: Stupidest Programming Mistakes
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Programming Vex w/ MPLab | dababyjebus | FIRST Tech Challenge | 27 | 25-04-2008 09:11 |
| Programming - Getting Started | Mark McLeod | Programming | 80 | 16-04-2008 23:37 |
| VEX programming | Gene F | Programming | 14 | 08-08-2006 22:21 |
| Suggestion for Delphi Programming Posts | Chris Hibner | CD Forum Support | 1 | 27-07-2005 10:02 |
| Robot Programming Education | phrontist | Programming | 11 | 03-05-2004 07:32 |