Dumbest mistake you have ever made
Dumbest mistake you have ever made
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?
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.
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.
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.
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. =)
after a good half-hour of beating my head on the desk, I realized I never installed the network cards IRQ's.
stupidstupidstupid. =)
Website: https://joscor.com
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".
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.
- AndrewAPrice
- Member
- Posts: 2299
- Joined: Mon Jun 05, 2006 11:00 pm
- Location: USA (and Australia)
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.
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.
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!
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!
- AndrewAPrice
- Member
- Posts: 2299
- Joined: Mon Jun 05, 2006 11:00 pm
- Location: USA (and Australia)
You have two options: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!
- Decrease the size of the file.
- Increase the size of the disk (http://www.netadmintools.com/art195.html)
My OS is Perception.
You forgot the third:MessiahAndrw wrote:You have two options: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!
- Decrease the size of the file.
- Increase the size of the disk (http://www.netadmintools.com/art195.html)
- Get my ext2 driver working. Then I have a 50MB image to use
You forgot the fourth ... 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.
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*
Regards
inflater
One day, when implementing main system interrupt in my OS, I tested my "WaitForKeyPress" function. The whole system froze.
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*
LOL I didn't heard what you said, can you repeat that?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.
Regards
inflater
My web site: http://inflater.wz.cz (Slovak)
Derrick operating system: http://derrick.xf.cz (Slovak and English )
Derrick operating system: http://derrick.xf.cz (Slovak and English )
- piranha
- Member
- Posts: 1391
- Joined: Thu Dec 21, 2006 7:42 pm
- Location: Unknown. Momentum is pretty certain, however.
- Contact:
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.
I was annoyed, maybe pissed off.
-JL
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.
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
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
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
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.
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.
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:
I have to ENLARGE MY EDITOR'S FONT SIZE
Code: Select all
LEA EAX , [EDI + 256]
LEA EDX , [EBP - (266 + (3*4))]
I have to ENLARGE MY EDITOR'S FONT SIZE
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.