3 ms·
Yet those optimization passes have been essential for keeping C alive. Optimizing C well depends on exploiting undefined behavior. And if not for optimizing com
by pcwalton 10y ago
Yet those optimization passes have been essential for keeping C alive. Optimizing C well depends on exploiting undefined behavior. And if not for optimizing compilers, I think C would have been replaced a long time ago.
For example, when everything can legally alias everything else (as in the case of "classic" C), it's hard for a compiler to prove anything about the contents of memory. This prevents a lot of seemingly-obvious optimizations. The problem with C is that you need to violate many programmers' assumptions about how the language operates in order to make it fast.
It's not a coincidence that a lot of C/C++ compiler developers have ended up moving on to other languages.
- pjmlp 10y ago> It's not a coincidence that a lot of C/C++ compiler developers have ended up moving on to other languages. Some examples are Chris Lattner, Doug Gregor or Cliff Click. Or as Chris Lattner puts it, he writes C and C++ so that we don't have to.