-Wextra真的有用吗? [英] -Wextra how useful is it really?
问题描述
-Wextra
,其他内容意味着 -Wtype-limits
:
$ b
如果比较始终为真或者
始终为假,则警告由于数据类型的限制范围
,但不要警告
常量表达式。例如,如果一个无符号变量是
,用'<'或
'> ='与零相比,
会发出警告。这个警告也是由
-Wextra启用的。
我发现这个非常有用。
I'm reading the gcc manual at the moment, especially the part about warning/error flags. After reading the part about the -Wextra flag, I wonder if it is useful at all. It seems that it complains about things which seem to be rather subjective or a matter of taste. I'm not that experienced with gcc, I only use it from time to time for some small projects at university, so to all experienced C/C++ (or for whatever language you use gcc), what's the deal with -Wextra?
-Wextra
, among other stuff implies -Wtype-limits
:
Warn if a comparison is always true or always false due to the limited range of the data type, but do not warn for constant expressions. For example, warn if an unsigned variable is compared against zero with '<' or '>='. This warning is also enabled by -Wextra.
I find this really useful.
这篇关于-Wextra真的有用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!