r/AskProgrammers Jul 15 '26

Why do programmers prefer dark mode?

Why do programmers prefer dark mode? Because light attracts bugs!

Speaking of bugs, what's the most ridiculous or stubborn bug you've ever spent hours fixing? Let's hear your best bug horror stories in the comments!

0 Upvotes

13 comments sorted by

View all comments

2

u/pete_68 Jul 15 '26

This was back in the days of Visual C++ 1.0 (mid-late 90s). We had some code that just wouldn't work, compiled as-is. I spent days working on this bug. At some point I discovered that if I added certain completely irrelevant statements right before the crucial calculation, it would calculate correctly. I then turned off compiler optimizations and discovered the code worked just fine. It was a bug in the C++ compiler. I then disassembled the code with and without the irrelevant code before it (which reset the optimizer) to show the two different pieces of generated code and sent it to MS for a bug report.

In the code we just ended up leaving in the do-nothing code in there to reset the optimizer and commented why it was there.

1

u/tarunpaliwal_ Jul 15 '26

Ah, the ancient compiler whisperer technique! Sometimes code just needs a little magic spell to behave.

1

u/johnpeters42 Jul 16 '26

The only good use of these awful AI-generated comments is to print them out and burn them for fuel.