Hacker Timesnew | past | comments | ask | show | jobs | submitlogin

C compilers have been doing stuff like that for decades… trivial example: many compilers will insert an implicit return statement if you don’t do that.

Without this code execution would just continue to whatever function is in memory, if there’s one.

And yet… it’s still considered c language.



I think they meant more the new syntax.


It's still conforming C. It's not strictly conforming C, but no compiler extensions are. I'm not aware of any compiler that fully enforces strictly conforming C. It may not even be possible, since a strictly conforming program "shall not produce output dependent on any unspecified, undefined, or implementation-defined behavior"[1], which would require the compiler to reject any program that produces such output even though some cases can only be detected at runtime. And since strictly conforming programs can only use features of the language and standard library defined in the C standard, the compiler can't even insert runtime checks to exit the program if such behavior is encountered (since that would be a language extension).

[1] C17 standard 4.5


Implementation extensions have been around for decades. This seems as C as it can get! Also, the compiler has license to replace UB with anything, might as well be helpful.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: