...
Code Block |
---|
|
int a;
int b;
/* ... */
a == b;
|
This is likely a case of the programmer mistakenly using the equals operator ==
instead of the assignment operator =
.
...
Code Block |
---|
|
int a;
int b;
/* ... */
a = b;
|
Non-Compliant Code Example 2
...
Code Block |
---|
|
int *p;
/* ... */
*p++;
|
Compliant Solution 2
Correcting this example depends on the intent of the programmer. For instance, if dereferencing p
was done on accident, then p
should not be dereferenced.
Code Block |
---|
|
int *p;
/* ... */
p++;
|
Wiki Markup |
---|
If the intent was to increment the value referred to by {{p}}, then parentheses can be used to ensure {{p}} is dereferenced then incremented \[[EXP00-A. Use parentheses for precedence of operation]\]. |
Code Block |
---|
|
int *p;
/* ... */
(*p)++
|
Risk Assessment
The presence of code that has no effect could indicate logic errors that may result in unexpected behavior and vulnerabilities.
...