I run on Ubuntu 10.10.
man g++ talks about -O1, -O2, -O3 optimization options
I noticed that -O5 works also, as well as -O1000...
I used "g++ -v -O5 toto.cpp", but it is not clear to me what's the difference. What does -O5 do actually ?
-O5
currently does the same as -O3
, as does -O1000
. Optimization level 3 is currently the max, but the -O
flag accepts a higher level anyway for forward compatibility. Proof:
$ g++ -O2 -Q --help=optimizers > O2
$ g++ -O3 -Q --help=optimizers > O3
$ g++ -O5 -Q --help=optimizers > O5
$ g++ -O1000 -Q --help=optimizers > O1000
$ diff O2 O3
[ ... lots of output]
$ diff O3 O5
$ diff O3 O1000
$
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With