clowwindy
2013-06-17 21:42:10 +08:00
$ gcc -Wall main.c
main.c: 在函数‘main’中:
main.c:7:8: 警告:此函数中的‘fathoms’在使用前未初始化
$ clang -Wall main.c
main.c:7:14: warning: variable 'fathoms' is uninitialized when used here [-Wuninitialized]
feet = 6 * fathoms;
^~~~~~~
main.c:4:14: note: initialize the variable 'fathoms' to silence this warning
int fathoms;
^
= 0
1 warning generated.
$ clang --analyze main.c
main.c:7:12: warning: The right operand of '*' is a garbage value
feet = 6 * fathoms;
^ ~~~~~~~
1 warning generated.