g++ , vc2008, optimizer turn on

hi masters,
i'm reading inside the c++ object model,
in chapter 3, it mentions things such like "turn on the compiler optimizer".
is there a "switch" such that i can turn on and off the optimizer of compilers, e.g. g++, vc2008?
RTM.

For GNU, use the -O1 or -O2 switches.
For VC++, go to Project Options and set optimizations to the levels you want.

Hope this helps.
Clone Thread:
http://cplusplus.com/forum/general/25062/

For GNU, there's also an -O3 switch, and if you need it, an -Os switch that optimizes for size.

EDIT:
http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html

-Albatross
Last edited on
Topic archived. No new replies allowed.