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

    Instant segmentation fault

  4. @palaueb 8mo

    That code lacks bolognesse sauce

    1. @b7sum 8mo

      comments?

      1. @palaueb 8mo

        Deleted \n and \t

        1. @deadgnom32 8mo

          \r

          1. @palaueb 8mo

            That's mad

    2. @SamsonovAnton 8mo

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

  5. アレックス 8mo

    refactor this, make no mistakes

  6. @palaueb 8mo

    Don't hallucinate

  7. @SpYvy 8mo

    lgtm

  8. dev_meme 8mo

    It tried but failed

  9. @SamsonovAnton 8mo

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

    1. @deadgnom32 8mo

      C doesn't support non-ascii

      1. @SamsonovAnton 8mo

        c++?

        1. @feedable 8mo

          i don't think it does either

          1. @feedable 8mo

            the standard version anyway well unless they changed something recenlty

      2. _ 8mo

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

          C++ at least does

          1. @feedable 8mo

            I think C too

          2. @feedable 8mo

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

            1. @feedable 8mo

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

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

          1. _ 8mo

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

            1. @feedable 8mo

              well, yes, that's intentional

              1. @feedable 8mo

                because msvc basically

              2. _ 8mo

                And that was my point

            2. @deadgnom32 8mo

              I was too lazy to search for a standard specification

      3. @SamsonovAnton 8mo

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

          ASCII = 7-bit encoding, mhm

          1. @chupasaurus 8mo

            also got code page vietnam flashbacks

        2. @deadgnom32 8mo

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

    2. @feedable 8mo

      so yes that's valid at least now

  10. @palaueb 8mo

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

      😭

      1. @deadgnom32 8mo

        штош / しかし / well

      2. @deimossos 8mo

        Cursed

        1. @SamsonovAnton 8mo

          Well, it looks like...

        2. @deadgnom32 8mo

          why?

  11. @palaueb 8mo

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

  12. _ 8mo

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

    1. @feedable 8mo

      no, compilers do support many

  13. @palaueb 8mo

    F in the chat

Use J and K for navigation