Top "Compiler-optimization" questions

Compiler optimization involves adapting a compiler to reduce run-time or object size or both.

Is there a reason why not to use link-time optimization (LTO)?

GCC, MSVC, LLVM, and probably other toolchains have support for link-time (whole program) optimization to allow optimization of calls among …

c++ c performance compilation compiler-optimization
How do I make an infinite empty loop that won't be optimized away?

The C11 standard appears to imply that iteration statements with constant controlling expressions should not be optimized out. I'm taking …

c clang language-lawyer compiler-optimization
How do C/C++ compilers work?

After over a decade of C/C++ coding, I've noticed the following pattern - very good programmers tend to have …

c++ c compiler-construction compiler-optimization
What is the difference between the /Ox and /O2 compiler options?

Microsoft's C++ compiler (cl.exe, as included with Visual Studio) offers several optimization switches. The difference between most of them …

c++ visual-studio visual-c++ compiler-optimization compiler-options
Can compiler optimization introduce bugs?

Today I had a discussion with a friend of mine and we debated for a couple of hours about "compiler …

optimization compiler-construction compiler-optimization
What kind of optimization does const offer in C/C++?

I know that where possible you should use the const keyword when passing parameters around by reference or by pointer …

c++ c constants compiler-optimization
GCC -Wuninitialized / -Wmaybe-uninitialized issues

I am experiencing a very strange issue using gcc-4.7 (Ubuntu/Linaro 4.7.2-11precise2) 4.7.2. I am unable to compile the following …

c++ c gcc compiler-optimization gcc-warning
Is it possible to tell the branch predictor how likely it is to follow the branch?

Just to make it clear, I'm not going for any sort of portability here, so any solutions that will tie …

c gcc x86 compiler-optimization micro-optimization
How to decrease the size of generated binaries?

I know that there is an option "-Os" to "Optimize for size", but it has little affect, or even increase …

linux gcc compiler-optimization strip
Why can lambdas be better optimized by the compiler than plain functions?

In his book The C++ Standard Library (Second Edition) Nicolai Josuttis states that lambdas can be better optimized by the …

c++ optimization c++11 lambda compiler-optimization