Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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

PRQA QA-C

Include Page
Astrée
Include Page
Astrée_V
Astrée_V
empty-parameter-listFully checked
Axivion Bauhaus Suite
Include Page
Axivion Bauhaus Suite_V
Axivion Bauhaus Suite_V
CertC-DCL20
CodeSonar
Include Page
CodeSonar_V
CodeSonar_V
LANG.FUNCS.PROTIncomplete function prototype
Helix QAC
Include Page
Helix QAC_V
Helix QAC_V
C3001, C3007
Klocwork
Include Page
Klocwork_V
Klocwork_V
MISRA.FUNC.NO_PARAMS
LDRA tool suite 
Include Page
LDRA_V
LDRA_V
63 SFully Implemented
Parasoft C/C++test
Include Page
Parasoft_V
Parasoft_V

CERT_C-DCL20-a

The number of arguments passed to a function shall match the number of parameters
PC-lint Plus

Include Page
PC-lint Plus_V
PC-lint Plus_V

937

Partially supported

RuleChecker
Include Page
RuleChecker_V
RuleChecker_V
empty-parameter-listFully checked
SonarQube C/C++ Plugin
PRQA QA-C_vPRQA QA-C_v

3001
3007

 

SonarQube
 
Include Page
SonarQube C/C++ Plugin_V
SonarQube C/C++ Plugin_V
 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

...


...

Image Modified Image Modified Image Modified