Is optimization of the whole C ++ program in gcc if I set -O3 optimization?

I am wondering if the whole program will be optimized if I just specify optimization level 3 in gcc (version 4.8.1 running on Ubuntu 12.04), or if I have to explicitly specify the optimization of the whole program as a gcc option?

+7
c ++ performance optimization gcc
source share
1 answer

-fwhole-program (and -flto ) are not automatically set by any of the -O options. Source: http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html . Parameters that are part of the -O optimization level are marked as such there, and there is also a list of allowed options for each -O .

+9
source share

All Articles