gcc -Wchar-subscripts test_signed_char.ctest_signed_char.c: In function `main':test_signed_char.c:13: warning: array subscript has type `char' 其输出结果:-1-41974761从输出结果来看Solaris 9/gcc 3.2上char默认实现类型为signed char
-Wcatch-value (C++ and Objective-C++ only) -Wchar-subscripts -Wclass-memaccess (C++ and Objective-C++ only) -Wcomment -Wdangling-else -Wdangling-pointer=2 -Wdelete-non-virtual-dtor (C++ and Objective-C++ only) -Wduplicate-decl-specifier (C and Objective-C only) -Wenum-compare (in C/O...
-Waddress -Warray-bounds (only with -O2) -Wc++0x-compat -Wchar-subscripts -Wimplicit-int -Wimplicit-function-declaration -Wcomment -Wformat -Wmain (only for C/ObjC and unless -ffreestanding) -Wmissing-braces -Wnonnull -Wparentheses -Wpointer-sign -Wreorder -Wreturn-type -Wsequence-point ...
- Wchar-subscripts 选项: 对数组下标为char类型给出警告。这是一个常见的错误。因为大多数char类型为有符号数。 - Wfatal-errors 选项: 编译器遇到第一个错误时,就停止下来,不继续检查更多错误。 我不建议使用, 每次编译就出一个错误,多浪费时间。 -Wreturn-type 选项: Warn whenever a function is defined wi...
-Wchar-subscripts 当下标类型为“char”时给出警告 -Wcharacter-truncation 对被截断的字符表达式给出警告 -Wclobbered 对能为"longjmp"或"vfork"所篡改的变量给出警告 -Wcomment 对可能嵌套的注释和长度超过一个物理行长的C++ 注释给出警告 -Wcomments -Wcomment 的同义词 ...
-Wchar-subscripts 当下标类型为“char”时给出警告 -Wcharacter-truncation 对被截断的字符表达式给出警告 -Wclobbered 对能为"longjmp"或"vfork"所篡改的变量给出警告 -Wcomment 对可能嵌套的注释和长度超过一个物理行长的C++ 注释给出警告 ...
-Wchar-subscripts: 使用char类作为数组下标(因为char可能是有符号数) -Wcomment: 注释使用不规范。如“/* */”注释中还包括“/*”。我在项目源码发现过,不止一处。 -Wmissing-braces 括号不匹配。在多维数组的初始化或赋值中经常出现。下面a没有完整被初始化,b完整初始化: ...
-lxxx 在连接的时候搜索xxx动态库,越底层的库越要放在后面(没有空格) -fPIC 产生与位置无关的代码 -Wall(打开所有警告信息) -Wall turns on the following warning flags: -Waddress -Warray-bounds (only with -O2) -Wc++11-compat -Wchar-subscripts -Wenum-compare (in C/ObjC; this is on by defau...
-Wchar-subscripts -Wimplicit-int -Wimplicit-function-declaration -Wcomment -Wformat -Wmain (only for C/ObjC and unless -ffreestanding) -Wmissing-braces -Wnonnull -Wparentheses -Wpointer-sign -Wreorder -Wreturn-type -Wsequence-point -Wsign-compare (only in C++) -Wstrict-aliasing -Wstrict-over...
1. -Wall 集合警告选项 我们平时可能大多数情况只使用-Wall 编译警告选项,实际上Wall 选项是一系列警告编译选项的集合。下面逐一分析这一集合中的 各个选项: [-Wchar-subscripts] 如果数组使用 char 类型变量做为下标值的话,则发出警告。因为 在某些平台上 char 可能默认为 signed char,一旦溢出,就可能导致 某些...