What's the stupidest mistake you ever made?
- sack
- Baaaaaaa!

- Posts: 7077
- Joined: Fri May 10, 2002 4:13 pm 0
- XBL Gamertag: evilgopher
- PSN: sixFiveOhTwo
- Location: Rijswijk, The Netherlands
- Contact:
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.
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.
- hairy_pete
- Baaaaaaa!

- Posts: 7217
- Joined: Mon May 27, 2002 8:10 pm 0
- Location: A Tiny Village in Bavaria
[quote="piku"]
Hence the coding rule that such equation is to be written with the constant on the left side,
so that it doesn't compile when you write
Code: Select all
if (x = 50)
some_code();
else
some_other_code();
Code: Select all
if (50==x)
blah();
else
blurb();
Code: Select all
if (50=x)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

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
The most important people in your life are taken away too soon and the arseholes never go a away.
- randomdude
- Baaaaaa!

- Posts: 4609
- Joined: Sat Aug 02, 2003 3:54 am 0
Grr. The amount of times.. I've done that.. !!piku wrote:Code: Select all
if (x = 50) some_code(); else some_other_code();
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
<Wife_of_Snake> Random the sugar rush fairy!
<}stinky_beast{> I'd do a zebra if it'd stand still
- unita_logica
- Baa!

- Posts: 39
- Joined: Mon Dec 27, 2004 8:42 pm 0
- Yahoo Messenger: cubelogicinfo
- Location: San Leandro
- Contact:
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.
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.
Thank god they dropped it in java...randomdude wrote:Grr. The amount of times.. I've done that.. !!piku wrote:Code: Select all
if (x = 50) some_code(); else some_other_code();
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...
- Dvorak
- Baaaaaa!

- Posts: 4560
- Joined: Wed May 08, 2002 7:37 am 0
- Yahoo Messenger: d3dxquaternion
- Location: Germany
Jesus! Unbelievable. That is the reason for that writing?hairy_pete wrote:Hence the coding rule that such equation is to be written with the constant on the left side,so that it doesn't compile when you writeCode: Select all
if (50==x) blah(); else blurb();Code: Select all
if (50=x)
I didn't know that...
>take off sunglasses
Seamen and fishermen alike swear to have heard voices in the rising tide. Inhuman screams, some of them say.
Seamen and fishermen alike swear to have heard voices in the rising tide. Inhuman screams, some of them say.
- piku
- Sheepie Whore

- Posts: 20960
- Joined: Wed Apr 24, 2002 10:44 am 0
- Website: Http://Www.ncot.uk
- Location: Wakefield
- Contact:
The other fun C ones are:
And just play with pointers for an afternoon
trying to free() null variables is a great way to stop your program.
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;
}
return (0);
Swear filters are a legendary problem. The usual failure test is a simple one: "Scunthorpe." (It's an English seaside town)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...
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.
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.
What, don't you use emacs then?piku wrote:The other fun C ones are:
Code: Select all
if (cnut == 32) some_code(); some_more(); rest_of_code();
As a young C prog, I was a bit obsessed with neat-looking code. I decided to convert this:
to this:
.. in the interests of aesthetics. 2 hours of head-scratching and cussing later, I changed it back and was cured of that particular obsession 
Code: Select all
#define foo1 123
#define foo2 234
#define foo3 23Code: Select all
#define foo1 123
#define foo2 234
#define foo3 023- piku
- Sheepie Whore

- Posts: 20960
- Joined: Wed Apr 24, 2002 10:44 am 0
- Website: Http://Www.ncot.uk
- Location: Wakefield
- Contact:
#define foo3 027 would have been OK thoughfritx wrote:.. in the interests of aesthetics. 2 hours of head-scratching and cussing later, I changed it back and was cured of that particular obsessionCode: Select all
#define foo1 123 #define foo2 234 #define foo3 023
return (0);
- nyarla
- 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:
hairy_pete wrote:piku wrote:Hence the coding rule that such equation is to be written with the constant on the left side,Code: Select all
if (x = 50) some_code(); else some_other_code();so that it doesn't compile when you writeCode: Select all
if (50==x) blah(); else blurb();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?
