Rust Optimizations That C++ Can't Do
I find it funny and think it&#x27;s pretty telling that there are bold claims made that are only crossed out after the author is corrected. I feel like a C++ compiler (or any compiler, really) could do practically any optimization that any other one can do, unless that language has explicit restrictions prohibiting such an optimization (e.g. like if the language prohibits the implementation from generating multiple copies of code).<p>The question is just how smart the compiler would need to be, and that changes as a function of how strict the language is. The more loose the language is, the more smart the compiler needs to be. The more information you encode in the type (or make easy to infer), the less smart the compiler needs to be. Whether it&#x27;s practical to develop a smart-enough compiler in a reasonable amount of time is probably the real issue.