How to enable optimization in G++ with #pragma
问题 I want to enable optimization in g++ without command line parameter. I know GCC can do it by writing #pragma GCC optimize (2) in my code. But it seems won't work in G++. This page may help: http://gcc.gnu.org/onlinedocs/gcc/Function-Specific-Option-Pragmas.html My compiler version: $ g++ --version g++ (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1 <suppressed copyright message> $ gcc --version gcc (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1 <suppressed copyright message> I worte some code like this: #pragma