CFLAGS [Makefile]

 CFLAGS

-Wall:选项可以打印出编译时所有的错误或者警告信息。这个选项很容易被遗忘,编译的时候,没有错误或者警告提示,以为自己的程序很完美,其实,里面有可能隐藏着许多陷阱。变量没有初始化,类型不匹配,或者类型转换错误等警告提示需要重点注意,错误就隐藏在这些代码里面。没有使用的变量也需要注意,去掉无用的代码,让整个程序显得干净一点。下次写Makefile的时候,一定加-Wall编译选项。

优化资料1 优化资料2

-O0: Do not optimize. This is the default.

-O1: Optimize. Optimizing compilation takes somewhat more time, and a lot more memory for a large function.

-O2: Optimize even more. GCC performs nearly all supported optimizations that do not involve a space-speed tradeoff.

-O3: Optimize yet more.

-Os:Optimize for size.-Osenables all-O2optimizations that do not typically increase code size. It also performs further optimizations designed to reduce code size.

posted on 2020-06-01 09:36  liujx2019  阅读(933)  评论(0编辑  收藏  举报

导航