What's the stupidest mistake you ever made?

Coders forum. Discuss techniques, swap code snippets, ask for help etc. relating to all forms of software development.
User avatar
sack
Baaaaaaa!
Baaaaaaa!
Posts: 7077
Joined: Fri May 10, 2002 4:13 pm 0
XBL Gamertag: evilgopher
PSN: sixFiveOhTwo
Location: Rijswijk, The Netherlands
Contact:

Post by sack »

throw together library routines on the gameboy colour. music, scrolling, walking player... compiles and runs fine.

then after a few seconds the player starts walking left. out of player control.

study code - fine.

study further fine.

get fucked off with my music as i've listened to it for so long i comment out the interrupt call.

works now.

turns out i forgot to stack 1 register in the interrupt, it was always kicking in precisely between calling the joypad read and interpreting it, and the content left upon exiting the interrupt was the same as holding left down.


whatatit.
User avatar
hairy_pete
Baaaaaaa!
Baaaaaaa!
Posts: 7217
Joined: Mon May 27, 2002 8:10 pm 0
Location: A Tiny Village in Bavaria

Post by hairy_pete »

[quote="piku"]

Code: Select all

if (x = 50)
    some_code();
else
    some_other_code();
Hence the coding rule that such equation is to be written with the constant on the left side,

Code: Select all

if (50==x)
   blah();
else
   blurb();
so that it doesn't compile when you write

Code: Select all

if (50=x)
User avatar
Stevo
Baaaaaa!
Baaaaaa!
Posts: 3545
Joined: Mon Jan 12, 2004 11:00 am 0
Location: Perth, WA

Post by Stevo »

My stupidest mistake ever made was not finishing
the computer programming course that I took
back in 1984 and going for the life
of Sex,Drugs and Rock and Roll.............

But I am now A part time Computer Technician
and I still cant code to save my life


:D :D :D
The most important people in your life are taken away too soon and the arseholes never go a away.
User avatar
randomdude
Baaaaaa!
Baaaaaa!
Posts: 4609
Joined: Sat Aug 02, 2003 3:54 am 0

Post by randomdude »

piku wrote:

Code: Select all

if (x = 50)
    some_code();
else
    some_other_code();
Grr. The amount of times.. I've done that.. !!
I am both the king and the queen of cheese.
<Wife_of_Snake> Random the sugar rush fairy!
<}stinky_beast{> I'd do a zebra if it'd stand still
User avatar
unita_logica
Baa!
Baa!
Posts: 39
Joined: Mon Dec 27, 2004 8:42 pm 0
Yahoo Messenger: cubelogicinfo
Location: San Leandro
Contact:

Post by unita_logica »

one time in high school at the CS lab class I was with 2 buddies of mine at a single computer. One was thinking, coding, and typing; the other was staring into the void occasionally saying "ah yes, that's correct", and I was just fucking sleeping. All of a sudden, I wake up. I don't know why, but I do wake up. I look at the monitor - a shitty windows95 screen with some horrible fonts, or maybe it was Windows 3.11, I don't fucking remember. My buddy is still typing. I move my glance down, and stare for a couple of seconds at that clunky black button at the bottom of the computer box. My eyes are half closed. Interesting, I mumble. Then I reach out, I feel the button, and I hit it.

Holy fucking shit. The reset button. A sudden scream. The buddy that was occasionally saying "Ah yes..." now screams "NOOOOOOOOOOOO!" and something like "What the fuck have you done, fool?!?" - he says that in an Italian dialect (of our area) and it sounds much more colourful like that. My blood freezes, I look at the thinker/coder guy in search of understanding, yet he states:

"Now YOU fucking type it all back."

Never felt so embarassed in my entire life.
User avatar
bloid
Baaaaaa!
Baaaaaa!
Posts: 4082
Joined: Wed Dec 17, 2003 3:12 pm 0
Location: Mancuniana

Post by bloid »

randomdude wrote:
piku wrote:

Code: Select all

if (x = 50)
    some_code();
else
    some_other_code();
Grr. The amount of times.. I've done that.. !!
Thank god they dropped it in java...

when I was learning C, and working at CERN, that and the for-loop with a semi-colon at the end of it were my two biggest bugbears... :(
"What's there to lose?" said the general, selling our dead meat by the pound...
User avatar
Dvorak
Baaaaaa!
Baaaaaa!
Posts: 4560
Joined: Wed May 08, 2002 7:37 am 0
Yahoo Messenger: d3dxquaternion
Location: Germany

Post by Dvorak »

hairy_pete wrote:Hence the coding rule that such equation is to be written with the constant on the left side,

Code: Select all

if (50==x)
   blah();
else
   blurb();
so that it doesn't compile when you write

Code: Select all

if (50=x)
Jesus! Unbelievable. That is the reason for that writing?
I didn't know that... 8O
>take off sunglasses
Seamen and fishermen alike swear to have heard voices in the rising tide. Inhuman screams, some of them say.
User avatar
piku
Sheepie Whore
Sheepie Whore
Posts: 20960
Joined: Wed Apr 24, 2002 10:44 am 0
Website: Http://Www.ncot.uk
Location: Wakefield
Contact:

Post by piku »

The other fun C ones are:

Code: Select all

if (cnut == 32)
    some_code();
    some_more();

rest_of_code();

Code: Select all

int x[9];
int i;

for (i = 0; i < 10; i++)
    printf ("How long before a segfault? %d\n", i);
    x[i] = i;
}
And just play with pointers for an afternoon :) trying to free() null variables is a great way to stop your program.
return (0);
User avatar
Dio
Sheepie Whore
Sheepie Whore
Posts: 18887
Joined: Mon May 31, 2004 1:08 pm 0
Location: Newcastle UK

Post by Dio »

bloid wrote:When I was coding a MUD, I put a swear filter in to stop people shouting offensive words... (mostly becuase the guy who was hosting the mud didn't like it)... I told him that it probably wouldn't work, and people would find a way round it, but he insisted...
Swear filters are a legendary problem. The usual failure test is a simple one: "Scunthorpe." (It's an English seaside town)
User avatar
Dio
Sheepie Whore
Sheepie Whore
Posts: 18887
Joined: Mon May 31, 2004 1:08 pm 0
Location: Newcastle UK

Post by Dio »

I have heard tell of a friend who was working on an airline reservation database, where the test database and the real one accidentally got swapped over. Now, we all know the sort of entries we use in our test code...

The first they found out about it was when the airline rang up and asked why a Mr. Shit Stabber hadn't turned up for his flight.
User avatar
Firefox
Sheepie Whore
Sheepie Whore
Posts: 11412
Joined: Fri Apr 26, 2002 6:15 pm 0
Location: Sheffield

Post by Firefox »

piku wrote:The other fun C ones are:

Code: Select all

if (cnut == 32)
    some_code();
    some_more();

rest_of_code();
What, don't you use emacs then? :twisted:
User avatar
moobaa
Sheepie Whore
Sheepie Whore
Posts: 16118
Joined: Sun Sep 29, 2002 8:08 am 0
XBL Gamertag: petee moobaa
PSN: moobaa
Location: Sydney, Australia

Post by moobaa »

Dio wrote:I have heard tell of a friend who was working on an airline reservation database, where the test database and the real one accidentally got swapped over. Now, we all know the sort of entries we use in our test code...
We've had clients ask which port the "Cuntox III" is registered in :twisted:
User avatar
fritx
Troll (2/10)
Posts: 912
Joined: Tue May 20, 2003 11:51 am 0
Location: Airstrip One
Contact:

Post by fritx »

As a young C prog, I was a bit obsessed with neat-looking code. I decided to convert this:

Code: Select all

#define foo1 123
#define foo2 234
#define foo3 23
to this:

Code: Select all

#define foo1 123
#define foo2 234
#define foo3 023
.. in the interests of aesthetics. 2 hours of head-scratching and cussing later, I changed it back and was cured of that particular obsession :)
User avatar
piku
Sheepie Whore
Sheepie Whore
Posts: 20960
Joined: Wed Apr 24, 2002 10:44 am 0
Website: Http://Www.ncot.uk
Location: Wakefield
Contact:

Post by piku »

fritx wrote:

Code: Select all

#define foo1 123
#define foo2 234
#define foo3 023
.. in the interests of aesthetics. 2 hours of head-scratching and cussing later, I changed it back and was cured of that particular obsession :)
#define foo3 027 would have been OK though :)
return (0);
User avatar
nyarla
Baaaaaa!
Baaaaaa!
Posts: 2820
Joined: Tue Jan 14, 2003 1:53 pm 0
Location: i said kiss me you're beautiful these are truly the last days
Contact:

Post by nyarla »

hairy_pete wrote:
piku wrote:

Code: Select all

if (x = 50)
    some_code();
else
    some_other_code();
Hence the coding rule that such equation is to be written with the constant on the left side,

Code: Select all

if (50==x)
   blah();
else
   blurb();
so that it doesn't compile when you write

Code: Select all

if (50=x)


this may be a dumb question...but what's this one all about? i only vaguely know C (i've been trying to mess around with it again recently...). could someone explain this to me? like..what's the difference between "if (x=50)" and "if (50==x)" (or "if (50=x)") ..or am i missing the point entirely? :)
Post Reply