...
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 | ||||||
Axivion Bauhaus Suite |
| CertC-DCL20 | |||||||
CodeSonar |
| LANG.FUNCS.PROT | Incomplete function prototype | ||||||
Helix QAC |
| C3001, C3007 | |||||||
Klocwork |
| MISRA.FUNC.NO_PARAMS | |||||||
LDRA tool suite |
| 63 S | Fully Implemented | ||||||
Parasoft C/C++test |
| CERT_C-DCL20-a | The number of arguments passed to a function shall match the number of parameters | ||||||
PC-lint Plus |
| 937 | Partially supported | ||||||
RuleChecker |
| empty-parameter-list | Fully checked | ||||||
SonarQube C/C++ Plugin |
3001
3007
| 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 |
...
...