Dumbest mistake you have ever made

Programming, for all ages and all languages.
Post Reply
User avatar
XCHG
Member
Member
Posts: 416
Joined: Sat Nov 25, 2006 3:55 am
Location: Wisconsin
Contact:

Dumbest mistake you have ever made

Post by XCHG »

What is the dumbest mistake you have ever made when writing a program? Did you laugh at yourself after noticing your mistake? What was the situation? :lol:
On the field with sword and shield amidst the din of dying of men's wails. War is waged and the battle will rage until only the righteous prevails.
User avatar
Alboin
Member
Member
Posts: 1466
Joined: Thu Jan 04, 2007 3:29 pm
Location: Noricum and Pannonia

Post by Alboin »

I had a pretty stupid one yesterday. I was working on my bootloader, and rewriting a memory map check function. After 15 minutes or so of testing with no results, I look to my code, and realize I forgot to call int 15h.

Y...e...a...h.... 8)
C8H10N4O2 | #446691 | Trust the nodes.
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Post by AJ »

Oh, but there are so many to choose from :)
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Post by Candy »

Too much options.

I'm torn between stupid mistakes I keep making over and over again and those that took me very long to find.

First category:
- Undeclared variable: i
- Forgetting an increment of an iterator in a while loop
- ((some) problem (lisp programmers ((wouldn't) have))

Second category:
- Including a comment on the symbols filtered by the next loop, consisting of ;, : and \
- Not zeroing memory and leaving a single uninitialized pointer in my task structure, plus adding a page fault handler that takes another random page to put at the location of page faults...
- Forgetting to overwrite the executable image before testing again.
User avatar
01000101
Member
Member
Posts: 1599
Joined: Fri Jun 22, 2007 12:47 pm
Contact:

Post by 01000101 »

I was recently working on the interrupt handler for my network cards and I couldnt for the life of me figure out why when I recieved a packet, it didnt fire up an interrupt and go to the handler.

after a good half-hour of beating my head on the desk, I realized I never installed the network cards IRQ's.

stupidstupidstupid. =)
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Post by Solar »

Not incrementing the loop variable in some kind of while-loop has propably happened to everyone at one time or another. I for one had this as a "favourite" error while drawing NSD diagrams during SE classes (because I was "thinking" for-loops, where you write the increment at the top, and forgot to add it at the bottom).

But nothing could beat the 36+ hours of madness-inducing debugging of the PDCLib print() function (the one that does the brunt work for printf() and its relatives), which happened at Breakpoint 2006. It turned out that I did increment the wrong variable. It was so stupid a mistake I howled in pain when I finally found it.

But, as a colleague of mine once put it, "every bug is trivial - once you've found it".
Every good solution is obvious once you've found it.
User avatar
AndrewAPrice
Member
Member
Posts: 2299
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Post by AndrewAPrice »

I once was calling:
someClass->someFunction((0,1));
wondering why it wouldn't work. I took me about a week until I realised I had double brackets which calculated to passing 1 as the first parameter, rather than passing 0 as the first and 1 as the second parameter.
My OS is Perception.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

My favourite has to be when I recompiled Bash for my OS. The autoconf script this time picked up on more features I'd added to the standard libraries so enabled more builtins. The size of the executable went up from 880KB to 1.6MB.

It took me a good two days debugging and wondering why the string tables wouldn't load properly to discover that in fact a 1.6MB file plus my kernel and 3 servers wouldn't fit on a 1.44MB floppy disk...

D'oh!
User avatar
AndrewAPrice
Member
Member
Posts: 2299
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Post by AndrewAPrice »

JamesM wrote:My favourite has to be when I recompiled Bash for my OS. The autoconf script this time picked up on more features I'd added to the standard libraries so enabled more builtins. The size of the executable went up from 880KB to 1.6MB.

It took me a good two days debugging and wondering why the string tables wouldn't load properly to discover that in fact a 1.6MB file plus my kernel and 3 servers wouldn't fit on a 1.44MB floppy disk...

D'oh!
You have two options:
- Decrease the size of the file.
- Increase the size of the disk (http://www.netadmintools.com/art195.html)
My OS is Perception.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

MessiahAndrw wrote:
JamesM wrote:My favourite has to be when I recompiled Bash for my OS. The autoconf script this time picked up on more features I'd added to the standard libraries so enabled more builtins. The size of the executable went up from 880KB to 1.6MB.

It took me a good two days debugging and wondering why the string tables wouldn't load properly to discover that in fact a 1.6MB file plus my kernel and 3 servers wouldn't fit on a 1.44MB floppy disk...

D'oh!
You have two options:
- Decrease the size of the file.
- Increase the size of the disk (http://www.netadmintools.com/art195.html)
You forgot the third:

- Get my ext2 driver working. Then I have a 50MB image to use :)
User avatar
inflater
Member
Member
Posts: 1309
Joined: Thu Sep 28, 2006 10:32 am
Location: Slovakia
Contact:

Post by inflater »

You forgot the fourth :D ... make your own 2,88MB floppy drive from your ordinary 1.44. ;) [Couldn't find where the manual was located]

One day, when implementing main system interrupt in my OS, I tested my "WaitForKeyPress" function. The whole system froze. :D
I spend one hour tracing the assembly code in Bochs and I couldn't find the bug. Now I saw the beginning of my INT 0x30 code; CLI on the start; forgot to STI before the function call. *bangs head* :mrgreen:
XCHG's sig wrote:On the field with sword and shield amidst the din of dying of men's wails. War is waged and the battle will rage until only the righteous prevails.
LOL :shock: I didn't heard what you said, can you repeat that? :lol:

Regards
inflater
My web site: http://inflater.wz.cz (Slovak)
Derrick operating system: http://derrick.xf.cz (Slovak and English :P)
User avatar
piranha
Member
Member
Posts: 1391
Joined: Thu Dec 21, 2006 7:42 pm
Location: Unknown. Momentum is pretty certain, however.
Contact:

Post by piranha »

OK, here's mine(happened yesterday):

I spent 2 hours writing a complicated function that reads a file from the disk, and scans it then loads settings from it, and configures the rest of the program from that one file. But it didn't work. I tried for another hour to find the bug. Then I realized that I had forgotten to make the file. :evil: :evil: :evil: :evil: :evil: :evil: :evil: :cry: :cry: :cry: :oops: :oops:


I was annoyed, maybe pissed off.

-JL
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
User avatar
ucosty
Member
Member
Posts: 271
Joined: Tue Aug 08, 2006 7:43 am
Location: Sydney, Australia

Post by ucosty »

Early in my os I was wondering why a whole block of code was not running at all. Turns out I kept forgetting to copy the newer kernel to the floppy image. :(
The cake is a lie | rackbits.com
niteice
Member
Member
Posts: 59
Joined: Tue Oct 03, 2006 3:49 pm

Post by niteice »

I had some debug messages that were printed at a verbosity level that was generally reserved for annoying debug messages (i.e. a printf on every line). I had them at that level because I assumed they would never be seen.

I sat banging my head against the desk for three weeks or so, and ended up removing the functionality that depended on the module that printed those messages.

About a week later, I was polishing up said module. I discovered that the messages were never printed, but had some critical error information that could have saved three weeks of work and had the intended functionality still working.
User avatar
XCHG
Member
Member
Posts: 416
Joined: Sat Nov 25, 2006 3:55 am
Location: Wisconsin
Contact:

Post by XCHG »

I was just writing my file system's driver, and I was wondering why the result of a string comparison on two strings was being inaccurate. Seems that I had put 266 instead of 256 in my code like this:

Code: Select all

          LEA     EAX , [EDI + 256]
          LEA     EDX , [EBP - (266 + (3*4))]

I have to ENLARGE MY EDITOR'S FONT SIZE :roll:
On the field with sword and shield amidst the din of dying of men's wails. War is waged and the battle will rage until only the righteous prevails.
Post Reply