...
Again, the simplest solution is to explicitly specify void
as the only parameter.
Risk Assessment
Recommendation | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
DCL20-C | Medium | Probable | Low | P12 | L1 |
Automated Detection
Tool | Version | Checker | Description | ||||||
Astrée |
| empty-parameter-list | Fully checked | ||||||
CodeSonar |
| LANG.FUNCS.PROT | Incomplete function prototype | ||||||
Klocwork |
| MISRA.FUNC.NO_PARAMS |
LDRA tool suite |
| 63 S | Fully Implemented | ||||||
Parasoft C/C++test |
|
|
| MISRA2004-16_6 | Fully implemented | |||||||
RuleChecker |
| empty-parameter-list | Fully checked | ||||||
SonarQube C/C++ Plugin |
| S929 |
Related Vulnerabilities
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
...
In C++, foo()
and foo(void)
have exactly the same meaning and effect, so this rule doesn't apply to C++. However, foo(void)
should be declared explicitly instead of foo()
to distinguish it from foo(...)
, which accepts an arbitrary number and type of arguments.
MISRA C:2012 | Rule 8.2 (required) |
Bibliography
[ISO/IEC 9899:2011] | Subclause 6.7.6.3, "Function Declarators (including Prototypes)" Subclause 6.11.6, "Function Declarators" |
[TIGCC, void usage] | Manual, "C Language Keywords": void |
...
...