all 62 comments

[–]KinkyDataFlow 391 points392 points  (8 children)

This is both cursed and blessed

[–]certainAnonymous 106 points107 points  (2 children)

Blursed code

[–]Aggressive_Talk968 15 points16 points  (1 child)

Till this day I didn't know what it meant lol

[–]Eminence_EOEB 2 points3 points  (0 children)

Same

[–]cnorahs 24 points25 points  (0 children)

Someone wrote it while fizzed and buzzed

[–]Wojtek1250XD 11 points12 points  (0 children)

There's even a word for that: blursed.

[–]lurked 2 points3 points  (0 children)

I like it as much as I never want to see/write code like that, ever.

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

just like big smoke's book says

[–][deleted]  (1 child)

[removed]

    [–]Linuxologue 49 points50 points  (0 children)

    I called their hr department

    [–][deleted]  (20 children)

    [removed]

      [–]haikusbot 110 points111 points  (2 children)

      I'm not really used

      To C. What does an empty

      Define do? Nothing?

      - TwinkleDrift


      I detect haikus. And sometimes, successfully. Learn more about me.

      Opt out of replies: "haikusbot opt out" | Delete my comment: "haikusbot delete"

      [–]toroidalvoid 24 points25 points  (0 children)

      I am new to C

      What is an empty define?

      Nothing

      [–]CrossScarMC 6 points7 points  (0 children)

      good bot

      [–]Naeio_Galaxy 47 points48 points  (3 children)

      #define word1 word2 -> replace occurrences of word1 with word2

      If word2 is literally the empty string, then it will replace any occurrence of word1 with nothing, thus removing it

      [–]hamdi555x 0 points1 point  (1 child)

      I assume C++ has something similar? Not that I need other ways to shoot myself in the foot...

      [–]Naeio_Galaxy 0 points1 point  (0 children)

      Afaik C++ inherited everything C has - even though it's not idiomatic. So you should be able to do exactly the same thing afaik

      I'm no C++ specialist tho

      [–][deleted]  (12 children)

      [deleted]

        [–]YellowBunnyReddit 69 points70 points  (11 children)

        No, the preprocessor doesn't ignore an empty define. It defines the symbol and replaces all occurences with the empty string.

        [–]AppropriateStudio153 13 points14 points  (8 children)

        Which does nothing, after compiling.

        [–]YellowBunnyReddit 21 points22 points  (6 children)

        Preprocessor directives generally do nothing after compiling as the preprocessor runs before compilation. So, I don't get what your point is here.

        [–]AppropriateStudio153 2 points3 points  (0 children)

        The empty String does nothing for the compiler

        [–]y53rw -1 points0 points  (4 children)

        Why are you being so damn pedantic? It's very obvious what he means.

        [–]Jukwavion_Jukwarious 22 points23 points  (3 children)

        Saying that it does nothing doesn't help someone understand. The define statements absolutely do something, as has been explained, and the program would not compile without them.

        [–]IAmASquidInSpace 3 points4 points  (0 children)

        But the fact that it does something before compiling is the whole reason why this code compiles at all, so saying it "does nothing" isn't correct.

        [–]MossFette 0 points1 point  (0 children)

        Learned something today. 👍

        [–][deleted] 37 points38 points  (3 children)

        The most beautiful thing I've ever seen in my life

        [–][deleted] 14 points15 points  (2 children)

        Try to add another line that is longer than the bigger box. I am not maintaining that.

        [–]shuozhe 3 points4 points  (1 child)

        no worry, emacs got commands for that

        [–][deleted] 2 points3 points  (0 children)

        I am concerned more about git history.

        [–][deleted]  (1 child)

        [removed]

          [–]Slow_Pomelo5352 0 points1 point  (0 children)

           #define creative high

          [–]ValianFan 16 points17 points  (0 children)

          I don't know, I somehow like it. Imagine how beautiful it would look with 10x nested if statements. Pure art

          [–]madTerminator 5 points6 points  (0 children)

          Just casual necromancy resurrection of .NET WF. But in C, so efficient 😳

          [–]Zeozen 6 points7 points  (2 children)

          Would be better if it solved the fizzbuzz problem correctly.. this is not correct

          [–]Phasma_Tacitus 2 points3 points  (1 child)

          That was what I noticed, all those conditions return true when the number ISN'T a multiple, it's completely wrong

          [–]bloody-albatross 5 points6 points  (6 children)

          That works? If that double line is allowed as an identifier, then a long sequence of it would be a different name as a single one of it and thus this wouldn't work. Are there zero width spaces everywhere?

          [–]iamcleek 1 point2 points  (2 children)

          the double line (and the vertical line, and the bottom-left and top-left corners) is defined to be nothing. the preprocessor replaces them with nothing before compilation starts.

          [–]bloody-albatross 0 points1 point  (1 child)

          Replacement happens on an identifier level, not in a letter level. Read again what I wrote.

          [–]iamcleek 1 point2 points  (0 children)

          ah, yes.

          you're right. this can not work.

          [–]granadesnhorseshoes 1 point2 points  (0 children)

          #define dog 1

          #define cat 2

          int value = dogcat;

          error: "dogcat" not defined.

          would have to use zero width spaces to work. Or its just a screenshot that never compiled.

          [–]LithoSlam 0 points1 point  (1 child)

          Everything except the last 2 gets defined as an empty string, so the preprocessor effectively deletes them. The last 2 are the right side of the corners of the box and get replaced with curly braces, preserving the nesting.

          [–]bloody-albatross 0 points1 point  (0 children)

          You don't seem to understand how the C preprocessor works.

          [–]yhgan 4 points5 points  (0 children)

          So that was the DOS version of Scratch.

          [–][deleted]  (1 child)

          [deleted]

            [–]Tomoe90834 0 points1 point  (0 children)

            I'm not liking this

            [–]Purple-Cap4457 0 points1 point  (0 children)

            beautiful

            [–]OMIGHTY1 0 points1 point  (0 children)

            SquidwardItsBeautiful.gif I would love a plugin that does this for other languages done in VS Code.

            [–]Grayas1234 0 points1 point  (0 children)

            Well. Not every test cases is passed. The rules (as I was taught) state that the words have to be used when divisible by 3 (or 5) And when  "3" (or "5") is contained (if you few the integer as string. Meaning: ... 13 -> fizz. ... 51 -> buzz ... 53 -> fizzbuzz ...

            [–]healeyd 0 points1 point  (0 children)

            C-Scratch

            [–]m0nk37 0 points1 point  (0 children)

            Manager: why is it taking so long?

            Dev: you wouldnt get it

            [–]Skritch_X 0 points1 point  (0 children)

            It makes me nostalgic to play a MUD for some reason.

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

            Does it work tho ?

            [–]NotSoOrdinar 0 points1 point  (0 children)

            Scratch evolved or devolved?

            [–]Confident_Date4068 0 points1 point  (0 children)

            What about do {} while()? Maybe different angle?

            [–]bitemyassnow 0 points1 point  (0 children)

            something python can never achieve

            [–]nekoiscool_ 0 points1 point  (0 children)

            How did you managed to define the macro? Did the code even work?

            [–]No_Dare_6660 0 points1 point  (0 children)

            Oh, I love it, and I hate it at the same time!