Skip to content
DevMeme
7038 of 7590
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 6mo

    Instant segmentation fault

  4. @palaueb 6mo

    That code lacks bolognesse sauce

    1. @b7sum 6mo

      comments?

      1. @palaueb 6mo

        Deleted \n and \t

        1. @deadgnom32 6mo

          \r

          1. @palaueb 6mo

            That's mad

    2. @SamsonovAnton 6mo

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

  5. アレックス 6mo

    refactor this, make no mistakes

  6. @palaueb 6mo

    Don't hallucinate

  7. @SpYvy 6mo

    lgtm

  8. dev_meme 6mo

    It tried but failed

  9. @SamsonovAnton 6mo

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

    1. @deadgnom32 6mo

      C doesn't support non-ascii

      1. @SamsonovAnton 6mo

        c++?

        1. @feedable 6mo

          i don't think it does either

          1. @feedable 6mo

            the standard version anyway well unless they changed something recenlty

      2. _ 6mo

        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 6mo

          C++ at least does

          1. @feedable 6mo

            I think C too

          2. @feedable 6mo

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

            1. @feedable 6mo

              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 6mo

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

          1. _ 6mo

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

            1. @feedable 6mo

              well, yes, that's intentional

              1. @feedable 6mo

                because msvc basically

              2. _ 6mo

                And that was my point

            2. @deadgnom32 6mo

              I was too lazy to search for a standard specification

      3. @SamsonovAnton 6mo

        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 6mo

          ASCII = 7-bit encoding, mhm

          1. @chupasaurus 6mo

            also got code page vietnam flashbacks

        2. @deadgnom32 6mo

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

    2. @feedable 6mo

      so yes that's valid at least now

  10. @palaueb 6mo

    #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 6mo

      😭

      1. @deadgnom32 6mo

        штош / しかし / well

      2. @deimossos 6mo

        Cursed

        1. @SamsonovAnton 6mo

          Well, it looks like...

        2. @deadgnom32 6mo

          why?

  11. @palaueb 6mo

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

  12. _ 6mo

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

    1. @feedable 6mo

      no, compilers do support many

  13. @palaueb 6mo

    F in the chat

Use J and K for navigation