开发者

About g++ -O option

开发者 https://www.devze.com 2023-02-19 01:37 出处:网络
I run on Ubuntu 10.10. man g++talks about -O1,开发者_C百科 -O2, -O3 optimization options I noticed that -O5 works also, as well as -O1000...

I run on Ubuntu 10.10.

man g++ talks about -O1,开发者_C百科 -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
$
0

精彩评论

暂无评论...
验证码 换一张
取 消