marshall
marshall

Reputation: 2483

How to turn on optimization in C source code?

Is it possible to write C code so that when it is compiled with

gcc -o foo foo.c

it in fact compiles foo.c with -O2?

I am using gcc 4.4.6.

Upvotes: 2

Views: 134

Answers (1)

ensc
ensc

Reputation: 6994

recent gcc knows a #pragma GCC optimize pragma (http://gcc.gnu.org/onlinedocs/gcc/Function-Specific-Option-Pragmas.html)

Upvotes: 5

Related Questions