News for hackers. Stuff that matters.
Re:Writing a C Compiler (2017) by RcouF1uZ4gsC on Friday June 09, 2023 @08:42AM (#36257008)
Here is how to write a C compiler in Python that correctly compile the vast majority of C programs per the ISO C standard:

    print(“You have some form of undefined behavior, which means printing this is a valid response per the C standard”)
Re:Writing a C Compiler (2017) by tialaramex on Friday June 09, 2023 @10:06AM (#36257996)
Undefined Behaviour has to actually happen, and so that means at runtime†, and thus what you wrote is not a valid C compiler.

For C++ IFNDR ("Ill-formed, No diagnostic required") the situation is trickier because the affected programs (some unknowable but likely large proportion of all purported C++ code) are not well formed C++, the standard offers no hint as to what happens or why, since it constrains only the behaviour of a C++ compiler for well formed C++ programs.

† It's possible the C lexer claims to have some "Undefined Behaviour" cases like the C++ lexer, hence P2621 "UB? In my lexer?" which is a reference to a 2005 meme because C++ standards committee members are down with the kids, but that's clearly a standards text bug if so because it makes no sense to have UB in the lexer, these should just be ill-formed programs, you get a compiler error.