Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "CDT/Archive/designs/StaticAnalysis/CheckerIdeas"
< CDT | Archive | designs | StaticAnalysis
(New page: ;Unused #include #include <stdio.h> int main() { return 1; } ;Malloc called without sizeof consideration int * arr = (int *)malloc(20); // should be malloc(20*sizeof(int)) ;Assigned ...) |
|||
Line 12: | Line 12: | ||
(!(!x)) | (!(!x)) | ||
(x!=0 || 0!=x) | (x!=0 || 0!=x) | ||
+ | ;Consequent re-assignment without usage (sub-case of Value is never used after assignment) | ||
+ | x=1; | ||
+ | x=2; | ||
+ | ;Value is never used after assignment | ||
+ | int x; | ||
+ | x=23; | ||
+ | return; | ||
+ | ;Unused local variable | ||
+ | :local variable is not used in function | ||
+ | ;Undeclared variable | ||
+ | :This is compiler error - catch early and have a quick fix so Ctrl-1 work like in java, I so like java quick fixes and code generation! | ||
+ | { x = 5; } | ||
+ | :Quick fix | ||
+ | { int x = 5; } |
Revision as of 15:46, 25 March 2010
- Unused #include
#include <stdio.h> int main() { return 1; }
- Malloc called without sizeof consideration
int * arr = (int *)malloc(20); // should be malloc(20*sizeof(int))
- Assigned to itself
x = x;
- Result of comparison is constant
(x==x) (!x && x)
- Redundant comparison operations
(!(!x)) (x!=0 || 0!=x)
- Consequent re-assignment without usage (sub-case of Value is never used after assignment)
x=1; x=2;
- Value is never used after assignment
int x; x=23; return;
- Unused local variable
- local variable is not used in function
- Undeclared variable
- This is compiler error - catch early and have a quick fix so Ctrl-1 work like in java, I so like java quick fixes and code generation!
{ x = 5; }
- Quick fix
{ int x = 5; }