...
Code Block | ||||
---|---|---|---|---|
| ||||
int a = ((81 / i) * i) * i); /* evaluatesEvaluates to 243 */ |
which is not the desired behavior.
...
In this noncompliant code example, END_OF_FILE
is defined as -1
. The macro replacement list consists of a unary negation operator , followed by an integer literal 1:
...
In this example, the programmer has mistakenly omitted the comparison operator from the conditional statement, which should be getchar() != END_OF_FILE
. (See MSC02-C. Avoid errors of omission.) After macro expansion, the conditional expression is incorrectly evaluated as a binary operation: getchar()-1
. This statement is syntactically correct, even though it is certainly not what the programmer intended. Note that this example also violates DCL00-C. Const-qualify immutable objects.
...
Tool | Version | Checker | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
| macrbody | Fully implemented | |||||||
| 77 S | Fully implemented | |||||||
PRQA QA-C |
| 3409 | Fully implemented |
Related Vulnerabilities
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
...