Skip to content
DevMeme
7038 of 7663
CodeQuality Post #7717 · source on Telegram

int main() { Bowl of Spaghetti }: C Program Body as Spaghetti Code

Description

A visual pun meme formatted like a C source file. Black code-style text blocks read 'include <stdio.h>' (missing the '#'), 'int main()', and an opening brace '{' - but the function body is a photograph of a white bowl filled with tangled plain spaghetti noodles, closed at the bottom by a '}' brace. The spaghetti literally stands in for the program's implementation, riffing on 'spaghetti code': tangled, unstructured control flow with no discernible architecture. The classic C boilerplate framing (stdio.h, main) signals that from the entry point onward, it's all noodles

Comments

44
Anonymous ★ Top Pick Compiles on the first try, too - spaghetti code's only reliable property is that it works until the one person who understands the sauce leaves
  1. Anonymous ★ Top Pick

    Compiles on the first try, too - spaghetti code's only reliable property is that it works until the one person who understands the sauce leaves

  2. Anonymous

    The dependencies are circular, but at least they are al dente.

  3. Eugene 7mo

    Instant segmentation fault

  4. @palaueb 7mo

    That code lacks bolognesse sauce

    1. @b7sum 7mo

      comments?

      1. @palaueb 7mo

        Deleted \n and \t

        1. @deadgnom32 7mo

          \r

          1. @palaueb 7mo

            That's mad

    2. @SamsonovAnton 7mo

      And is probably overwhelmed with syntactic sugar — consume with caution!

  5. アレックス 7mo

    refactor this, make no mistakes

  6. @palaueb 7mo

    Don't hallucinate

  7. @SpYvy 7mo

    lgtm

  8. dev_meme 7mo

    It tried but failed

  9. @SamsonovAnton 7mo

    int main() { return "🍕"[0]; }

    1. @deadgnom32 7mo

      C doesn't support non-ascii

      1. @SamsonovAnton 7mo

        c++?

        1. @feedable 7mo

          i don't think it does either

          1. @feedable 7mo

            the standard version anyway well unless they changed something recenlty

      2. _ 7mo

        I don't think the standard specifies any charset ? Then it's up to the implementation to use ASCII, Latin-1, UTF-8 or EBDIC.

        1. @feedable 7mo

          C++ at least does

          1. @feedable 7mo

            I think C too

          2. @feedable 7mo

            https://eel.is/c++draft/tab:lex.charset.basic

            1. @feedable 7mo

              https://eel.is/c++draft/lex.string#nt:basic-s-char is the stuff you can put in a string as of currently

        2. @deadgnom32 7mo

          the standard specifies it. you kinda declare utf as a multi-char value communicated outwards to interpret it as a utf character

          1. _ 7mo

            Do you have a reference ? The two links specifies minimal requirements for the charset, but do not seem to actually impose one

            1. @feedable 7mo

              well, yes, that's intentional

              1. @feedable 7mo

                because msvc basically

              2. _ 7mo

                And that was my point

            2. @deadgnom32 7mo

              I was too lazy to search for a standard specification

      3. @SamsonovAnton 7mo

        Plain C89 as seen by GCC 15.1. If 8-bit characters were not in fact supported by compilers, it would not be possible to hardcode string literals using any letters besides Latin.

        1. @chupasaurus 7mo

          ASCII = 7-bit encoding, mhm

          1. @chupasaurus 7mo

            also got code page vietnam flashbacks

        2. @deadgnom32 7mo

          well. nice to know. I also know for sure, that like 20 years ago I've got an error for that

    2. @feedable 7mo

      so yes that's valid at least now

  10. @palaueb 7mo

    #include <stdio.h> #define 🚀 main #define 📢 printf #define 🧱 int #define 🎁 { #define 📦 } #define 🎈 ( #define 🎊 ) #define 🏁 return #define ✅ 0 #define 💎 ; 🧱 🚀 🎈 🎊 🎁 📢 🎈 "Hello World! 🌍🔥✨" 🎊 💎 🏁 ✅ 💎 📦 /* gcc -finput-charset=UTF-8 hello.c -o hello */ For your enjoyment

    1. @SamsonovAnton 7mo

      😭

      1. @deadgnom32 7mo

        штош / しかし / well

      2. @deimossos 7mo

        Cursed

        1. @SamsonovAnton 7mo

          Well, it looks like...

        2. @deadgnom32 7mo

          why?

  11. @palaueb 7mo

    Wait, is this real spaghetti code with bolognaise? #include <stdio.h> #define 🍝 printf("Hello World! 🌍🍝\n"); return 0; int main() { 🍝 }

  12. _ 7mo

    Yes, compilers typically support only one encoding, but that encoding doesn't need to be ASCII

    1. @feedable 7mo

      no, compilers do support many

  13. @palaueb 7mo

    F in the chat

Use J and K for navigation