...
Code Block | ||
---|---|---|
| ||
static size_t _limit = 100; unsigned int getValue(unsigned int count){ size_t i; unsigned int result = 0; for(i = 0; i < _limit; i++){ result++; if(i == count){ break; } } } |
Compliant Code
In the compliant solution, the variable is does not begin with an underscore and hence is not reserved.
Code Block | ||
---|---|---|
| ||
size_t limit = 100;
unsigned int getValue(unsigned int count){
size_t i;
unsigned int result = 0;
for(i = 0; i < limit; i++){
result++;
if(i == count){
break;
}
}
}
|
Non Compliant Code
Identifiers with external linkage include setjmp, errno, math_errhandling, va_end.
In the example errno is defined.
...
Rule | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
DCL37-C | low | unlikely | Low | P3 | L3 |
Automated Detection
A module can be written in Compass/ROSE to detect violations of this rule
References
Wiki Markup |
---|
\[[ISO/IEC 9899:1999|AA. C References#ISO/IEC 9899-1999]\] Section 7.5, "Errors {{<errno.h>}}" |
—