MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/b61snk/that_famous_function/ejih8tm/?context=3
r/ProgrammerHumor • u/Synedh • Mar 27 '19
176 comments sorted by
View all comments
1.3k
A few years ago we downloaded a stopwatch javascript libarary and inspected the code. There was a funny line in it:
// if you delete this it will stop working in IE8 while (false) {}
We tried it and they were correct. We had no idea wtf was going on or how they figured this out.
549 u/Milleuros Mar 27 '19 how they figured this out.That will stay as one of the great mysteries of history. 395 u/cbusalex Mar 27 '19 have working code with loop "while (condition) { doTheThing(); }"some change makes loop no longer neededremove loopcode no longer works in IE8spend weeks trying to figure out why code is brokenmake no progressarduously test every commit in branch history until you find the one that broke itlooksFineToMe.jpgbegin to experiment piecemeal with every part of the commitcode works when "while (condition) { doTheThing(); }" loop is presentcode works when loop is present, even when condition never evaluates to truecode works when loop is present, even when doTheThing() does nothingcode works when loop is present, even when condition is literally just "false" and loop contents are emptycode still does not work without useless, completely neutered loopfuck it, blame it on ghosts or something 50 u/[deleted] Mar 27 '19 Thank you for making my day, stranger.
549
how they figured this out.
That will stay as one of the great mysteries of history.
395 u/cbusalex Mar 27 '19 have working code with loop "while (condition) { doTheThing(); }"some change makes loop no longer neededremove loopcode no longer works in IE8spend weeks trying to figure out why code is brokenmake no progressarduously test every commit in branch history until you find the one that broke itlooksFineToMe.jpgbegin to experiment piecemeal with every part of the commitcode works when "while (condition) { doTheThing(); }" loop is presentcode works when loop is present, even when condition never evaluates to truecode works when loop is present, even when doTheThing() does nothingcode works when loop is present, even when condition is literally just "false" and loop contents are emptycode still does not work without useless, completely neutered loopfuck it, blame it on ghosts or something 50 u/[deleted] Mar 27 '19 Thank you for making my day, stranger.
395
have working code with loop "while (condition) { doTheThing(); }"
some change makes loop no longer needed
remove loop
code no longer works in IE8
spend weeks trying to figure out why code is broken
make no progress
arduously test every commit in branch history until you find the one that broke it
looksFineToMe.jpg
begin to experiment piecemeal with every part of the commit
code works when "while (condition) { doTheThing(); }" loop is present
code works when loop is present, even when condition never evaluates to true
code works when loop is present, even when doTheThing() does nothing
code works when loop is present, even when condition is literally just "false" and loop contents are empty
code still does not work without useless, completely neutered loop
fuck it, blame it on ghosts or something
50 u/[deleted] Mar 27 '19 Thank you for making my day, stranger.
50
Thank you for making my day, stranger.
1.3k
u/Alokir Mar 27 '19
A few years ago we downloaded a stopwatch javascript libarary and inspected the code. There was a funny line in it:
We tried it and they were correct. We had no idea wtf was going on or how they figured this out.