logoalt Hacker News

aidenn0yesterday at 10:47 PM1 replyview on HN

The compiler does comply to the spec. It's the program that fails to comply with the spec. It's definitely possible to write programs that have no undefined behavior.


Replies

thaumasiotestoday at 6:40 AM

The compiler is supposed to compile programs that comply with the spec, and not compile programs that don't.

The concept of "compiling a program that doesn't comply with the spec" doesn't even exist! A text file that doesn't comply with the C spec isn't a C program. That's what it means to be "the spec".

show 2 replies