推荐的 C 的 gcc 警告选项 [英] Recommended gcc warning options for C

查看:33
本文介绍了推荐的 C 的 gcc 警告选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

除了 -Wall 之外,人们还发现哪些其他警告有用?

Other than -Wall what other warnings have people found useful?

http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Warning-Options.html

推荐答案

我经常使用:

    gcc -m64 -std=c99 -pedantic -Wall -Wshadow -Wpointer-arith -Wcast-qual 
        -Wstrict-prototypes -Wmissing-prototypes

对于不习惯它的人(我第一次使用这些标志编译其代码的人),这个集合吸引了很多;它很少给我带来问题(尽管 -Wcast-qual 偶尔会令人讨厌).

This set catches a lot for people unused to it (people whose code I get to compile with those flags for the first time); it seldom gives me a problem (though -Wcast-qual is occasionally a nuisance).

这篇关于推荐的 C 的 gcc 警告选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆