3 ms·
> This gets said a lot, No, this actually doesn't get said a lot, however the simplicity of C compilation semantics is one of its biggest strengths. > ... bu
by huhtenberg 7y ago
> This gets said a lot,
No, this actually doesn't get said a lot, however the simplicity of C compilation semantics is one of its biggest strengths.
> ... but unless you're writing C code for a microcontroller (or a PDP11), that isn't even close to being true.
Do humor us with an example of a C code that compiles into something that is "not even close" to what you'd reasonably expect.
- umanwizard 7y agoFor example: https://godbolt.org/z/m3xSse https://godbolt.org/z/m3xSse
- huhtenberg 7y agoHow is basic loop unrolling is "not even close" to the expected result when you explicitly ask for optimization with O3?
- umanwizard 7y agoThis isn’t basic loop unrolling; it’s replacing an entire loop with a closed form mathematical formula.
- huhtenberg 7y agoIt's a form of loop unrolling. Regardless of the term, this is still very much in the ballpark of what you'd expect when asking for optimization.