3 ms·
They are as aggressive as they can be. Here's an example of a C compiler completely eliminating a loop because it has figure out how to transform the loop into
by cogman10 2y ago
They are as aggressive as they can be.
Here's an example of a C compiler completely eliminating a loop because it has figure out how to transform the loop into a constant calculation.
https://godbolt.org/z/cfndqMj4j https://godbolt.org/z/cfndqMj4j
The place where C compilers are conservative is when dealing with arrays and pointers. That's because it's impossible for C to know if a pointer is to an element of an array or something completely different. Pointer math further complicates what a pointer could actually reference.