3 ms·
There is an entire class of compiler optimizations that can only be done on structured languages. If you include a "goto" command in a language you must either
by marcosdumay 13y ago
There is an entire class of compiler optimizations that can only be done on structured languages. If you include a "goto" command in a language you must either do a huge amount of statical analysis to map your language into a structured one, or live without such optimizations.
The fact that some code do not use a feature of the language does not help the computer generating a faster program.
Also, no, function calls are not equivalent to "goto".
- astrange 13y agoCompiler IL reduces all branches to the equivalent of "goto", so adding a few more is just no problem at all. More important obstacles to optimization include use of exceptions (now that makes control flow complicated), memory aliasing (any write to a char * is a scheduling barrier), overly-defined int math (can't prove loop iteration count), and the fact that your compiler has no idea what the hell is going on inside an x86 chip anyway.