4 ms·
The downside of reordering being performance? Or something else?
by WithinReason 5y ago
The downside of reordering being performance? Or something else?
- 10x-dev 5y agoPerformance is usually the upside. The downside is subtle bugs that can happen due to side effects of the statements being reordered between sequence points.
- WithinReason 5y agoAFAIK compilers don't reorder if it would change the result.
- Thiez 5y agoCompilers 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.