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
Use J and K for navigation
Comments
44Comment deleted
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
The dependencies are circular, but at least they are al dente.
Instant segmentation fault Comment deleted
That code lacks bolognesse sauce Comment deleted
comments? Comment deleted
Deleted \n and \t Comment deleted
\r Comment deleted
That's mad Comment deleted
And is probably overwhelmed with syntactic sugar — consume with caution! Comment deleted
refactor this, make no mistakes Comment deleted
Don't hallucinate Comment deleted
lgtm Comment deleted
It tried but failed Comment deleted
int main() { return "🍕"[0]; } Comment deleted
C doesn't support non-ascii Comment deleted
c++? Comment deleted
i don't think it does either Comment deleted
the standard version anyway well unless they changed something recenlty Comment deleted
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. Comment deleted
C++ at least does Comment deleted
I think C too Comment deleted
https://eel.is/c++draft/tab:lex.charset.basic Comment deleted
https://eel.is/c++draft/lex.string#nt:basic-s-char is the stuff you can put in a string as of currently Comment deleted
the standard specifies it. you kinda declare utf as a multi-char value communicated outwards to interpret it as a utf character Comment deleted
Do you have a reference ? The two links specifies minimal requirements for the charset, but do not seem to actually impose one Comment deleted
well, yes, that's intentional Comment deleted
because msvc basically Comment deleted
And that was my point Comment deleted
I was too lazy to search for a standard specification Comment deleted
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. Comment deleted
ASCII = 7-bit encoding, mhm Comment deleted
also got code page vietnam flashbacks Comment deleted
well. nice to know. I also know for sure, that like 20 years ago I've got an error for that Comment deleted
so yes that's valid at least now Comment deleted
#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 Comment deleted
😭 Comment deleted
штош / しかし / well Comment deleted
Cursed Comment deleted
Well, it looks like... Comment deleted
why? Comment deleted
Wait, is this real spaghetti code with bolognaise? #include <stdio.h> #define 🍝 printf("Hello World! 🌍🍝\n"); return 0; int main() { 🍝 } Comment deleted
Yes, compilers typically support only one encoding, but that encoding doesn't need to be ASCII Comment deleted
no, compilers do support many Comment deleted
F in the chat Comment deleted