Comment by JoshTriplett
1 day ago
ccdoom is delightfully impressive. It's a compiler compliant with the C standard, which outputs DOOM (the word, and the game) for all programs.
> ccdoom is a freestanding C implementation, as distinct from hosted implementations. The difference is that freestanding implementations need not support the full standard library, and may specify an alternative name and signature for main [2, Section 5.1.2.2].
> int math_errhandling(int argc, char* argv[]);
> Since math_errhandling is the program entry point and therefore always implicitly used, any program that fails to define it then contains a use of an undefined identifier, which is undefined behaviour [2, Section 6.9.1p5].
> On the other hand, any program which does define math_errhandling also has undefined behaviour. Per the standard [2, Section 7.12p20]:
Does this mean that all C programs invoke undefined behavior?
All C programs targeting this particular freestanding implementation do.