logoalt Hacker News

pjmlp • last Wednesday at 7:22 PM • 1 reply • view on HN

Yeah, but only toy compilers don't do optimizations.


Replies

Veserv • last Wednesday at 7:37 PM

Which is a strawman. They are clearly attempting to say that a compiler is supposed to generate a program that is semantically identical to the source code.

All observable and defined side effects should be identical otherwise you have a compiler bug. Optimizations that are not generically semantics preserving may be used, but should only be used where the program is semantically identical for your use case otherwise you have incorrectly used the options available in your compiler.

➕ show 1 reply