📄 00000007.htm
字号:
in a comment. <BR> <BR> -Wtrigraphs <BR> Warn if any trigraphs are encountered (assuming <BR> they are enabled). <BR> <BR> -Wformat <BR> Check calls to printf and scanf, etc., to make sure <BR> that the arguments supplied have types appropriate <BR> to the format string specified. <BR> <BR> -Wchar-subscripts <BR> Warn if an array subscript has type char. This is <BR> a common cause of error, as programmers often for- <BR> get that this type is signed on some machines. <BR> <BR> -Wuninitialized <BR> An automatic variable is used without first being <BR> initialized. <BR> <BR> These warnings are possible only in optimizing com- <BR> pilation, because they require data flow informa- <BR> tion that is computed only when optimizing. If you <BR> don't specify `-O', you simply won't get these <BR> warnings. <BR> <BR> These warnings occur only for variables that are <BR> candidates for register allocation. Therefore, <BR> they do not occur for a variable that is declared <BR> volatile, or whose address is taken, or whose size <BR> is other than 1, 2, 4 or 8 bytes. Also, they do <BR> not occur for structures, unions or arrays, even <BR> when they are in registers. <BR> <BR> Note that there may be no warning about a variable <BR> that is used only to compute a value that itself is <BR> never used, because such computations may be delet- <BR> ed by data flow analysis before the warnings are <BR> printed. <BR> <BR> These warnings are made optional because GNU CC is <BR> not smart enough to see all the reasons why the <BR> code might be correct despite appearing to have an <BR> error. Here is one example of how this can happen: <BR> <BR> { <BR> int x; <BR> switch (y) <BR> { <BR> case 1: x = 1; <BR> break; <BR> case 2: x = 4; <BR> break; <BR> case 3: x = 5; <BR> } <BR> foo (x); <BR> } <BR> <BR> If the value of y is always 1, 2 or 3, then x is <BR> always initialized, but GNU CC doesn't know this. <BR> Here is another common case: <BR> <BR> { <BR> int save_y; <BR> if (change_y) save_y = y, y = new_y; <BR> ... <BR> if (change_y) y = save_y; <BR> } <BR> <BR> This has no bug because save_y is used only if it <BR> is set. <BR> <BR> Some spurious warnings can be avoided if you de- <BR> clare as volatile all the functions you use that <BR> never return. <BR> <BR> -Wparentheses <BR> Warn if parentheses are omitted in certain con- <BR> texts. <BR> <BR> -Wtemplate-debugging <BR> When using templates in a C++ program, warn if de- <BR> bugging is not yet fully available (C++ only). <BR> <BR> -Wall All of the above `-W' options combined. These are <BR> all the options which pertain to usage that we rec- <BR> ommend avoiding and that we believe is easy to <BR> avoid, even in conjunction with macros. <BR> <BR> The remaining `-W...' options are not implied by `-Wall' <BR> because they warn about constructions that we consider <BR> reasonable to use, on occasion, in clean programs. <BR> <BR> -Wtraditional <BR> Warn about certain constructs that behave differ- <BR> ently in traditional and ANSI C. <BR> <BR> o Macro arguments occurring within string constants <BR> in the macro body. These would substitute the ar- <BR> gument in traditional C, but are part of the con- <BR> stant in ANSI C. <BR> <BR> o A function declared external in one block and then <BR> used after the end of the block. <BR> <BR> o A switch statement has an operand of type long. <BR> <BR> <BR> -Wshadow <BR> Warn whenever a local variable shadows another lo- <BR> cal variable. <BR> <BR> -Wid-clash-len <BR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -