Versions Compared

Key

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

...

Do not rely on implicit int typing. Section 6.7.2 of the C Standard [ISO/IEC 9899:2011] states:

At least one type specifier shall be given in the declaration specifiers in each declaration, and in the specifier-qualifier list in each struct declaration and type name.

...

Compliant Solution (Implicit Return Type)

This compliant solution explicily explicitly defines the return type of foo() as unsigned int.

...

Tool

Version

Checker

Description

GCC

Include Page
GCC_V
GCC_V

 

Can detect violations of this rule when the -Wimplicit and -Wreturn-type flags are used.

Compass/ROSE

 

 

 

Klocwork

Include Page
Klocwork_V
Klocwork_V

IF_MISS_DECL RETVOID.IMPLICIT

 

LDRA tool suite

Include Page
LDRA_V
LDRA_V

24 D
20 S
326 S

Fully implemented.

ECLAIR

Include Page
ECLAIR_V
ECLAIR_V

decltype

Fully implemented.

PRQA QA-C
Include Page
PRQA_V
PRQA_V

0434 (C)
1302
2050
2051
3335

Fully implemented.

Related Vulnerabilities

Search for vulnerabilities resulting from the violation of this rule on the CERT website.

Related Guidelines

ISO/IEC TR 24772"OTR Subprogram signature mismatch"
MISRA-C 

Bibliography

...

]Section 6.7.2, "Type

...

Specifiers," and section 6.5.2.2, "Function

...

Calls"

ISO/IEC TR 24772 "OTR Subprogram signature mismatch"

MISRA

Sources

...