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

The downside of reordering being performance? Or something else?


Performance is usually the upside. The downside is subtle bugs that can happen due to side effects of the statements being reordered between sequence points.


AFAIK compilers don't reorder if it would change the result.


Compilers not allowed to violate the language spec when optimizing. But the spec may be fairly generous in its allowed interpretations, which may not match what a programmer may naively expect. C, with its many undefined behaviors and implementation defined behaviors, is especially dangerous.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: