if C doesn't have reflection then explain this

https://gcc.godbolt.org/z/Gdo8vdYs4

Compiler Explorer - C (x86-64 clang 15.0.0)

/*\ } ()niam tni \*/ int main() { puts("Hello, World!"); /*\ ;("!dlroW ,olleH")stup { \*/ }

@luna Bonus points for making it executable. A+.
@luna oh that's beautiful
@luna Compiler Explorer allows you to be sneaky with the compile options: https://gcc.godbolt.org/z/5va1Gfa4E
Compiler Explorer - C (x86-64 clang 15.0.0)

/*\ } ()niam tni \*/ int main() { puts("Hello, World!"); /*\ ;("!dlroW ,olleH")stup { \*/ }

@luna oooh a new auto formatter. Excellent 😈
@luna the first line is killing me this doesn't parse in my head 
@kait @luna Yeah, how does the first line work? πŸ˜–
@larilille @kait tokens after the include directive get ignored (though the compiler will warn, and I suppressed the warning in the godbolt link)
@luna @kait Because of course the preprocessor has an entirely separate syntax to the actual language... *sigh*
@luna I don't understand how the first line compiles. πŸ€”
@s there’s a hint on the godbolt page :)

@luna Oh... It looks like you can put any old garbage after a #include <foo>

TIL 

@luna hmm the first line seems odd, sure it'd work regardless the preprocessor?

https://gcc.gnu.org/onlinedocs/cpp/Include-Syntax.html
"It is an error if there is anything (other than comments) on the line after the file name. "

Include Syntax (The C Preprocessor)

Include Syntax (The C Preprocessor)

@mmu_man @luna It looks like the C standard also doesn't permit this trick. See section 6.10.2, pages 149-150: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf

Still, fun that with some compilers it can work!

@luna beautifull, in its own way :)
@luna I'm making the cross face but I'm secretly quite impressed.
@luna awesome! Took a while to understand why this works πŸ‘πŸ˜…
@luna "this" cannot be explained with C, only with Java 🀭

@luna Luna.

(This is most excellent)

@luna Wll done! First line freaked me out until I read the spec...
@luna this is so cursed but lovely...
@luna k that is just plain gorgeous.

@luna

It works because the C preprocessor ignores the trailing text after a directive. (I had *no idea* that this works, and I've been developing C code since the late 80s.)

Everything else works because the relevant /* and */ sequences comment stuff out.

@luna

That's pretty special. :D

@luna bonus points for the ideal font πŸ‘Œ
@luna @gsuberland I think when people say that, they mean that this isn't "true" reflection: the ordering of letters is reversed but not the glyphs.
@luna this is so good it could've been a winning entry at the IOCCC
@luna @GyrosGeier Hey, finding your own code in memory and decompiling it is a perfectly cromulent form of reflection too :P

@luna
I find myself staring at that code for minutes...🀩 This ist mindblowing! I'm really impressed.

Even more since I understood why the first line compiles. 😜

@luna that is far too clever, I like it!
@luna brilliant reflective programming πŸ”πŸ˜Ž

@luna *squints eyes*

remove the comment characters, and your HOUSE OF LIES collapses

@lritter yes yes, they’re load-bearing comments
@luna haha, i love that term
@luna however #include not parsing anything that follows the one argument it cares about makes me feel less bad about my own parsers

@lritter @luna This reminds me of the palindrome entry in the 1987 IOCCC. The #include trick here might be what it takes to get the entry to compile on modern C compilers. It assumes putc exists for free and doesn’t include stdio.h

https://www.ioccc.org/1987/westley/westley.c

@luna Go sit in a corner. You know what you've done.
@luna hold up this actually compiles :O