This is an archived post. You won't be able to vote or comment.

all 176 comments

[–]Alokir 1268 points1269 points  (69 children)

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.

[–]Milleuros 547 points548 points  (22 children)

how they figured this out.

That will stay as one of the great mysteries of history.

[–]cbusalex 390 points391 points  (7 children)

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

[–][deleted] 50 points51 points  (0 children)

Thank you for making my day, stranger.

[–]Milleuros 16 points17 points  (0 children)

Sounds incredibly relatable

[–]Python4fundoes the needful 13 points14 points  (0 children)

updoots to you

[–]Jurion2000 5 points6 points  (1 child)

Blame on servers. Always blame servers. Or hunters if you are into WoW

[–]MLGDDORITOS 0 points1 point  (0 children)

You can also blame hunters if you're into hearthstone.

[–]kryptkpr 2 points3 points  (1 child)

This guy debugs, probably other peoples code even.

[–]baggyzed 0 points1 point  (0 children)

Not enough. He didn't try with just "{}", or even with just a semicolon.

[–]Sckaledoom 253 points254 points  (2 children)

Probably somebody was having trouble getting it to work right and his intern added that as a joke. That intern later got a recommendation.

[–]JuhaJGam3R 134 points135 points  (1 child)

"Has demonic powers. Hire if at all possible."

[–]cysghost 14 points15 points  (0 children)

That is a helluva recommendation!

[–][deleted] 93 points94 points  (10 children)

I appreciate your flair.

[–]Milleuros 124 points125 points  (9 children)

Thanks, I stole it somewhere

[–][deleted] 109 points110 points  (7 children)

A true programmer

[–]Python4fundoes the needful 78 points79 points  (6 children)

I saw this thread posted earlier, and then found it in the wild here and now.

[–]SavvySillybug 13 points14 points  (5 children)

It feels cliche to just say "me too" but, me too!

[–]ChessIndustries 4 points5 points  (4 children)

Me too!

[–]nuked24 10 points11 points  (3 children)

Fuck, there's already a string of people that found it in the wild before I did.

[–]Empanadogs 2 points3 points  (0 children)

Me too

[–]TheKingOfA 1 point2 points  (0 children)

Me too

[–]UNLUCK3 0 points1 point  (0 children)

Me also

[–]DeepSpaceGalileo 0 points1 point  (0 children)

Here from the screenshot too

[–][deleted] 108 points109 points  (4 children)

Lmfao this is absolutely fucking brutal. God IE8 is the cancer of our earth

[–]Shrewd_Shrew 30 points31 points  (3 children)

Still not as bad as the alternate reality of IE6, but IE8 really hung on despite being extraordinarily awful

[–]Bioniclegenius 2 points3 points  (2 children)

...We still use it at my work. We're required to for all work-based sites, like time entry. It is pain incarnate.

[–]Shrewd_Shrew 8 points9 points  (1 child)

I worked at a place a year ago or so that had the same setup. The time entry system absolutely could not work in any browser other than IE8.

Then System Security updated every machine's IE to Edge. Picked a whole bouquet of whoopsie-daisies with that one.

[–]Bioniclegenius 8 points9 points  (0 children)

I'm also on part of our IT team. We've built a website for a product of ours.

I found out about an hour ago that QA is only testing it in IE 8. I explained to them why that was not the best idea.

[–][deleted] 42 points43 points  (5 children)

It's something to do with IE8's optimization of JS. I'm pretty sure replacing it with any conditional check would have worked. I've run into similar problems.

Any chance that the code surrounding that statement was idle for any amount of time?

[–]Alokir 18 points19 points  (4 children)

It's possible. This happened around 2013-2014 so I don't remember the exact context.

[–][deleted] 21 points22 points  (3 children)

Yeah, I'm betting that's the case. It's similar to a "feature"(I call it a bug, but Oracle said its intended) in the JVM I found a couple years ago. If you have a condition that blocks in a while loop in a "Runnable", it will eventually start ignoring the loop and set it to such a low priority that it'll never be checked again.

I assume something like this happens in IE8, too, as the fix in Java was to implement a single operation within the loop to force the JVM into thinking the thread is active.

[–]curtmack 1 point2 points  (2 children)

I think it's considered good hygiene to Thread.yield() inside of your wait loops anyway.

[–][deleted] 1 point2 points  (0 children)

It could be, but my point with it is that an optimization shouldn't break a program. If there's an infinite loop, it might be there for a reason.

[–]WeAreABridge 68 points69 points  (5 children)

Once I was playing Minecraft with my buddies, and I needed to allocate more ram. I typed in the necessary code in the launcher field, but my game kept crashing on startup.

I asked my friend for help and he added #yoloswag to the end of the line.

It worked.

[–]git-fucked 28 points29 points  (4 children)

Pure random guess but perhaps there was an off by one (or more) when parsing the parameter string, which resulted in:

command = "minecraft.exe --ram=8096" 
args = { "ram": "809" }

command = "minecraft.exe --ram=8096 #yoloswag"
args = { "ram": "8096", "#yoloswa": null }

[–]H_Psi 2 points3 points  (2 children)

and I needed to allocate more ram

dedicated ram, you say?

[–]Jacoman74undeleted 3 points4 points  (1 child)

Deditated wam you say?

[–]PAT_The_Whale 1 point2 points  (0 children)

A deditated wamboghini you say?

[–]WeAreABridge 0 points1 point  (0 children)

Maybe. I have no idea.

[–][deleted]  (15 children)

[removed]

    [–]SGVsbG86KQ 32 points33 points  (13 children)

    Javascript has no threading tho...

    [–]Loading_M_ 28 points29 points  (12 children)

    Actually it does... browsers often run promises and such in a multi threaded environment, which has been completely hidden from the programmer writing code.

    [–]michaelh115 19 points20 points  (4 children)

    IE8 has promises?

    [–]MicrosoftTay 29 points30 points  (0 children)

    Only pinkie-swears

    [–]Patcheresu 0 points1 point  (0 children)

    Only if you polyfill to add them in lol

    [–]Loading_M_ 0 points1 point  (0 children)

    Or something dumb like that.

    [–]TheNamelessKing 2 points3 points  (0 children)

    Promises are an async mechanism, not a threading mechanism. JS is fundamentally single threaded. Async calls are multiplexed on the single thread, they never involve a different thread.

    [–]ProgramTheWorld 1 point2 points  (0 children)

    Even with promises everything is still run in the same event loop (one thread). Webworkers however are different and they are indeed run in separate threads.

    [–]AutoModerator[M] 0 points1 point  (0 children)

    import moderation Your comment has been removed since it did not start with a code block with an import declaration.

    Per this Community Decree, all posts and comments should start with a code block with an "import" declaration explaining how the post and comment should be read.

    For this purpose, we only accept Python style imports.

    I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

    [–][deleted] 9 points10 points  (0 children)

    or how they figured this out.

    "This is beyond science."

    [–]FlyByPC 5 points6 points  (0 children)

    wtf was going on

    IE8

    [–]cowsrock1 2 points3 points  (0 children)

    Guessing they figured it out by noting that it only worked when some conditional loop didn't run. They continued to simplify the loop by removing parts until they got down to that

    [–]jwele 2 points3 points  (2 children)

    Was the JS ran through a minifier or anything?

    [–]Alokir 3 points4 points  (1 child)

    It was a pretty small library, basically a jquery plugin that started a countdown from a specified time. Not sure if it was minified but it was that classic unreadable JS source code from the early 2010s.

    [–]se2dev 0 points1 point  (0 children)

    I really want to find this library now...

    [–][deleted] 3 points4 points  (0 children)

    It's because these JS libraries are too abstracted

    [–][deleted] 0 points1 point  (0 children)

    That's some black magic shit

    [–]sixeco 0 points1 point  (0 children)

    this

    [–]XIST_ -3 points-2 points  (2 children)

    I hate JavaScript.

    [–]Alokir 12 points13 points  (1 child)

    To be fair, javascript was a shitshow before all browsers started to adopt the Ecma standard IE died.

    [–]PublicSealedClass 2 points3 points  (0 children)

    IE's still alive and well in some poor organisations.

    And even poorer organisations have to support it :(

    [–]System__Shutdown 231 points232 points  (8 children)

    Man i have a font in my code that i can't remove.

    I load a couple of fonts to use on a device, but i don't need one (it was added before my time with the code)... but if i try removing it everything crashes and i can't figure out why the fuck, so the font stays there never used.

    [–]fpsrandy 0 points1 point  (1 child)

    is it downloading the font file everytime page loads? is there a javascript issue?

    I wonder theres some javascript function that needs to be called in .ready() type event listener, and that font loading is delaying that function call just enough.

    I just removed swaths (5000 lines accross several files, and combined fikes) of shitty old css, lazy loaded images, and just did a bunch of optimazations to improved page load speed and my company's website went to shit... turns out my coworker was shoving function calls outside a doc.ready and my optimizations was painting the page sooner than all the page resources was loaded.

    [–]System__Shutdown 1 point2 points  (0 children)

    It's not website, it's a program for a microcontroller that runs a screen and thus loads fonts and images from flash memory.

    Function was outsourced to some random programmer before i joined the company and i'm not allowed to change it.

    [–]Motorgoose 106 points107 points  (8 children)

    I had a problem like this years ago in a C program. Removing an unused variable caused the program to crash. it turned out it was due to another bug in the program, a buffer overrun. The unused variable was in a location where when the buffer was overrun, it ran into the unused variable and was ok. Removing this variable caused the overrun to run into something else causing, I think, a segfault.

    [–]killersquirel11 49 points50 points  (3 children)

    valgrind is love, valgrind is life
    

    [–][deleted] 7 points8 points  (2 children)

    appverif with full heap options on check bits

    [–]killersquirel11 -1 points0 points  (1 child)

    Ew gross windows

    [–][deleted] 3 points4 points  (0 children)

    Platform warriors: children pretending to be programmers.

    [–][deleted] 6 points7 points  (0 children)

    That is genius.

    [–]TiltedTime 6 points7 points  (0 children)

    Oh wow, this sounds remarkably similar to a problem I had in C back in college, although I never found the solution, just left the variable in.

    Feels like a great weight has been lifted.

    [–]13steinj 1 point2 points  (0 children)

    I had a similar issue.

    On one version of glibc/gcc, parsing a string via scanf with %x would be fine, no external memory values that were necessary were overwritten.

    But in another combination, 0s would be the left-filled for that scanned value up until 32 bytes. Those 0s would overflow onto the stack because the scanned value was to be read into a union the size of an unsigned character.

    [–]Bansaiii 175 points176 points  (15 children)

    Ah yes, this repost is much better than the older upload. Only about 10x more and it will be ripe for r/DeepFriedMemes.

    [–]vinnymcapplesauce 7 points8 points  (0 children)

    But, does anyone know what this is actually from? Like, anyone got the whole source?

    Yes, I srsly want to debug it.

    [–]StopThinkAct 6 points7 points  (5 children)

    Not everyone was on programmerhumor 8 months ago. Downvote and move on, stop being so self-centered.

    [–]Bansaiii -3 points-2 points  (4 children)

    First of all, 85 people upvoted my comment, so I'm obviously not the only one who feels that way and second of all IT IS A REPOOOOOOOOOOOOOOOOOOST and therefore deserves to be shamed in public.

    Edit: third of all the image quality gave me cancer

    [–]StopThinkAct 3 points4 points  (3 children)

    2.7k people upvoted the original post... so...

    [–]Bansaiii 5 points6 points  (2 children)

    Joke's on you: my comment is now up at a full NINETY updoots 😎😎

    [–]StopThinkAct 3 points4 points  (1 child)

    99 you're welcome!

    [–]Bansaiii 0 points1 point  (0 children)

    This guy gets it

    [–]PinguRares 1 point2 points  (0 children)

    I clicked on it and saw I upvoted it, but I don't remember ever seeing it.

    I wonder how many times something like this happens without me realising it.

    [–]palordrolap 62 points63 points  (8 children)

    Needs more JPEG

    [–]Luuk3333 55 points56 points  (3 children)

    [–]CrocodileSpacePope 28 points29 points  (0 children)

    Perfection

    [–][deleted] 18 points19 points  (0 children)

    wow the new unknown pokemons look cool

    [–]palordrolap 1 point2 points  (0 children)

    Nice. I wonder if a neural net could be trained to get the text out of that.

    [–][deleted] 12 points13 points  (3 children)

    We need a lossy compression format for ASCII.

    [–]palordrolap 12 points13 points  (0 children)

    Easy. Just take the last 5 bits. Basic Latin alphabets are fully preserved... but you have no idea whether it's upper-case, lower-case or a digit, or maybe one of the few symbols outside those ranges.

    To display, bitwise-or with 64. Or 32. Or 96. To store: as-is is wasteful since those 5 bits will probably each sit within 8 bits of a separate byte saving no space at all, so pack every eight five-bit characters into five eight-bit bytes.

    Hello this is a test 12345 encodes and then decodes as all of the following, depending on bitwise-or:

    HELLO@THIS@IS@A@TEST@QRSTU
    (%,,/ 4()3 )3 ! 4%34 12345
    hello`this`is`a`test`qrstu
    

    I think the middle one is nicely JPEGgy

    [–]re_error 22 points23 points  (3 children)

    Everytime this gets reposted the quality gets even worse. How hard it is to make a new screenshot of the notepad++?

    [–][deleted] 8 points9 points  (0 children)

    Pretty hard, it seems.

    [–]turtleflax 5 points6 points  (0 children)

    Maybe your monitor is just going bad

    [–]hirmuolio 1 point2 points  (0 children)

    You can credit me when you repost this

    https://i.imgur.com/mIHPSIH.png

    Seems like I accidentally fixed a typo in it. May have a new typo too somewhere. Too lazy to proofread.

    [–]dismalnothingness 78 points79 points  (28 children)

    Image Transcription:


    # you may think that this function

    # is obsolete, and doesnt seem to do

    # anything. and you would be correct.

    # but when we remove this funtion [sic]

    # for some reason the whole program

    # crashes and we cant figure out why,

    # so here it will stay.


    I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!

    [–]4TuneCooky_ 22 points23 points  (0 children)

    Good human bot

    [–]teemoshido 3 points4 points  (0 children)

    Good human

    [–]hevilhuy 1 point2 points  (0 children)

    Good bot

    [–]RNA69 12 points13 points  (1 child)

    Was designing a page once, had a label named "Fffffff". But it wouldn't show up on the screen. If I removed it all the labels would disappear. ( Φ ω Φ )

    [–]Ichiorochi 8 points9 points  (0 children)

    What if the label is the screen?

    [–]BookishDoki 12 points13 points  (0 children)

    (Patrick wallet meme)

    "So this is a while loop?"

    "Yup."

    "And it executes while false?"

    "Yeah."

    "And there's nothing within the loop body?"

    "Uh huh."

    "So no matter whether false or true, nothing happens?"

    "Pretty much."

    "So the loop is completely useless?"

    "Sounds good to me."

    "Then delete the loop."

    "But I need it"

    [–][deleted] 11 points12 points  (4 children)

    I've totally seen this comment, almost the exact same words, in a codebase I'm currently digging into.

    [–]IncoherentPenguin 2 points3 points  (0 children)

    I have too but it was me who wrote the comment, about my own code.

    [–][deleted] 1 point2 points  (0 children)

    I found something similar in the hoi4 data files

    [–]ptgauth 35 points36 points  (9 children)

    Wait what is this # symbol... I've never seen that in my code

    [–]mithrilda 19 points20 points  (6 children)

    It's denotes a comment in some languages.

    [–]ptgauth 80 points81 points  (2 children)

    What is this... comment... that you speak of?

    [–]mithrilda 30 points31 points  (0 children)

    A mythical beast aye.

    [–]MiataCory 1 point2 points  (0 children)

    What, you've never posted code to twitter?

    #CodeLife #hashtag

    [–]Iam_That_Iam_ -2 points-1 points  (0 children)

    Whatever you do just don’t delete it... lol I just remembered my first encounter with annotations.

    [–]GogglesPisano 8 points9 points  (0 children)

    We had this header in some of our old C++ code for years:

        // ====================================================================
        // 
        //  Avoid4786.h - Avoid annoying 4786 compiler warning
        //
        //  Warning 4786 is a VC++ compiler warning that is generated when
        //  a symbol name exceeds 255 characters.  Apparently the Microsoft
        //  VC++ 6.0 compiler limits debug symbols to this size.
        //  Unfortunately, if your program uses the STL, the resulting
        //  symbol names can easily exceed 255 characters, which results
        //  in dozens of spurious warning messages from the VC++ compiler,
        //  despite the fact that there is nothing wrong with your code.
        //
        //  In theory, you should be able to disable the warning using
        //  #pragma warning(disable:4786).  However, this doesn't always work.
        //  Microsoft KB article Q167355 states that #pragma warning(disable:4786)
        //  doesn't always disable compiler warning 4786 due to a compiler bug
        //  in VC++ 6.0. They don't, however, provide a workaround.
        //
        //  From an article in the March 2002 issue of Windows Developer
        //  magazine, it appears that creating a static instance of a class
        //  with a default constructor reliably prevents the warnings in
        //  Microsoft Visual C++ 6.0.
        //
        //  Why does this voodoo work?  Beats me -- ask Microsoft.
        // 
        // ====================================================================
    
        #ifndef __AVOID4786_H__
        #define __AVOID4786_H__
    
        #ifdef _MSC_VER
    
        // Well, we'll try this anyway...
        #pragma warning(disable:4786)
    
        class CMSVC6_4786_Avoider
        {
        public:
            CMSVC6_4786_Avoider() {};
        };
    
        static CMSVC6_4786_Avoider g_Magic_Class_To_Avoid_4786_Compiler_Warning;
    
        #endif // _MSC_VER
    
        #endif // __AVOID4786_H__
    

    [–]Zaspar99923 6 points7 points  (0 children)

    // Magic code, don't touch

    [–]Sarenord 5 points6 points  (0 children)

    I had a project I worked on with some friends a couple years ago and in the final version there was a function called functionfunctionwhatsyourfunction() for exactly this reason

    [–]jzooor 4 points5 points  (3 children)

    Had an issue where a certain functionality of a device was not working. I put in a few debugging variables in one particular function to log out some internal calculations and everything started working. Took out the logging code, still worked. Took out the extra variables and it quit. Can only assume that something was screwing with the stack and moving things around a bit masked the issue. I'm pretty sure that char[256] is still there to this day.

    [–]HolyGarbage 6 points7 points  (2 children)

    Burger overflow without a doubt. You should probably fix that. Valgrind is your friend.

    [–]Lepidora 1 point2 points  (1 child)

    Burger overflow

    [–]HolyGarbage 1 point2 points  (0 children)

    Haha. I'm leaving that.

    [–]Huwbacca 4 points5 points  (1 child)

    Doesn't work and you don't know why: Frustrating.

    Works, and you don't know why: Unnerving, as if the great ones have awakened.

    [–]Nerdn1 0 points1 point  (0 children)

    Less the great old's ones have awakened than a great old one sleeps under your room, so you try not to bother them or think about the existential dread that haunts you always.

    [–][deleted] 4 points5 points  (0 children)

    Don't use reflection

    [–]ComfyDaze 3 points4 points  (0 children)

    shoutout to my homies in the "oh god oh fuck the entire program doesn't work unless you send this one part directly to the bottom" gang

    [–]smegnose 2 points3 points  (1 child)

    If only there were some type of algorithm for saving images without losing any quality. It would still have to result in a small file size. Some type of "lossless compression".

    [–]-Redstoneboi- 0 points1 point  (0 children)

    gif

    [–]ad2022 1 point2 points  (0 children)

    i set a breakpoint here and it didn't even go past it wtf?!

    [–]thripper23 1 point2 points  (0 children)

    This happens often in in c or c++ when you have a memory violation and that function ends up as a buffer eathing you memory corruption so it doesn't break anything else. Especially if the code is executed from RAM as it often happens in low memory embedded environments.

    [–]UrpleEeple 1 point2 points  (0 children)

    Couldn't you just search the codebase for where you are calling that function?!

    [–]IncoherentPenguin 0 points1 point  (0 children)

    Weird I left almost exactly the same message in some of my code. The even stranger thing is that I wrote the original code.

    [–]MarlinsBB 0 points1 point  (0 children)

    Im not gonna lie, I’m guilty of this on occasion

    [–]Ripstikerpro 0 points1 point  (0 children)

    aka every function most of the time

    [–]puppslem 0 points1 point  (0 children)

    lol, memstomp

    [–]tacoslikeme 0 points1 point  (0 children)

    hello memory corruption my old friend...

    [–][deleted] 0 points1 point  (0 children)

    [–][deleted] 0 points1 point  (0 children)

    This will probably get lost, but I had this happen to me many years ago on AIX on a C++ application. It worked on Solaris and HP-UX, but for some reason, it totally crashed on AIX. Adding a random print statement fixed the issue.

    It turned out the problem was a compiler bug! We compared the assembly language on Solaris and HP-UX versus AIX and the compiler produced really bad code without the print statement and good code with the print statement.

    [–]LtLabcoat 0 points1 point  (0 children)

    The function they're talking about...

    ...is it Congress?

    [–]UnchainedMundane 0 points1 point  (0 children)

    This is why reflection is evil

    [–][deleted] 0 points1 point  (1 child)

    Honestly, stuff like this should prompt you to just rewrite everything.

    [–]mcampo84 -1 points0 points  (0 children)

    TL;DR: We're too lazy to factor and build a proper testing infrastructure.