gcc 的 -O2 选项有什么作用?
例如。gcc -O2 file1.c -o file1.o
答案1
这些-O
选项打开编译器优化。从man gcc
:
-O2 Optimize even more. GCC performs nearly all supported
optimizations that do not involve a space-speed tradeoff. As
compared to -O, this option increases both compilation time and the
performance of the generated code.
有关具体优化的列表,请参阅手册页。