Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Changed C24 -> C23

The C11 C23 Standard requires type specifiers and forbids implicit function declarations. The C90 Standard allows implicit typing of variables and functions. Consequently, some existing legacy code uses implicit typing. Some C compilers still support legacy code by allowing implicit typing, but it should not be used for new code. Such an implementation may choose to assume an implicit declaration and continue translation to support existing programs that used this feature.

...

C no longer allows the absence of type specifiers in a declaration. The C Standard, 6.7.3 paragraph 2 [ ISO/IEC 9899:20112024 ], states:

Except where the type is inferred (6.7.10), at At least one type specifier shall be given in the declaration specifiers in each declaration, and in the specifier-qualifier list in each struct member declaration and type name.

This noncompliant code example omits the type specifier:

...

Because implicit declarations lead to less stringent type checking, they can introduce unexpected and erroneous behavior. Occurrences of an omitted type specifier in existing code are rare, and the consequences are generally minor, perhaps resulting in abnormal program termination.

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

DCL31-C

Low

Unlikely

Low

P3

L3

Automated Detection

Tool

Version

Checker

Description

Astrée
Include Page
Astrée_V
Astrée_V

type-specifier

function-return-type

implicit-function-declaration

undeclared-parameter

Fully checked
Axivion Bauhaus Suite

Include Page
Axivion Bauhaus Suite_V
Axivion Bauhaus Suite_V

CertC-DCL31Fully implemented
Clang
Include Page
Clang_V
Clang_V
-Wimplicit-int
 

Compass/ROSE

 

 




Coverity
Include Page
Coverity_V
Coverity_V
MISRA C 2012 Rule 8.1Implemented
Cppcheck Premium

Include Page
Cppcheck Premium_V
Cppcheck Premium_V

premium-cert-dcl31-cPartially Implemented
Can detect implicit int
 

ECLAIR

Include Page
ECLAIR_V
ECLAIR_V

CC2.DCL31

Fully implemented

GCC
Include Page
GCC_V
GCC_V

 


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

Helix QAC

Include Page
Helix QAC_V
Helix QAC_V

C0434, C2050, C2051, C3335Fully implemented
Klocwork
Include Page
Klocwork_V
Klocwork_V
IF_MISS_DECL

CWARN.IMPLICITINT
MISRA.DECL.NO_TYPE
MISRA.FUNC.NOPROT.CALL
RETVOID.IMPLICIT

 

Fully implemented

LDRA tool suite
Include Page
LDRA_V
LDRA_V

24 D, 41 D, 20 S, 326 S, 496 S

Fully implemented

Parasoft C/C++test
9.5MISRA-020Partially implementedPolyspace Bug FinderR2016aMISRA2012-RULE-8_1, MISRA2012-RULE-17_3  FullPRQA QA-C Include Page
Include Page
Parasoft_V
Parasoft_V
CERT_C-DCL31-a
All functions shall be declared before use
PC-lint Plus

Include Page
PC-lint Plus_V
PC-lint Plus_V

601, 718, 746, 808

Fully supported

Polyspace Bug Finder

Include Page
Polyspace Bug Finder_V
Polyspace Bug Finder_V

CERT C: Rule DCL31-C


Checks for:

  • Types not explicitly specified
  • Implicit function declaration

Rule fully covered.

PVS-Studio

Include Page
PVS-Studio_V
PVS-Studio_V

V1031
PRQA QA-C_vPRQA QA-C_v

0434 (C)
1302
2050
2051
3335

Fully implemented

SonarQube C/C++ Plugin
Include Page
SonarQube C/C++ Plugin_V
SonarQube C/C++ Plugin_V
S819

, S820  Partially implemented; implicit return type not covered.
RuleChecker
Include Page
RuleChecker_V
RuleChecker_V

type-specifier

function-return-type

implicit-function-declaration

undeclared-parameter

Fully checked
TrustInSoft Analyzer

Include Page
TrustInSoft Analyzer_V
TrustInSoft Analyzer_V

type specifier missing

Partially verified (exhaustively detects undefined behavior).

Related Vulnerabilities

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

Related Guidelines

Key here (explains table format and definitions)

Taxonomy

Taxonomy item

Relationship

CERT C Secure Coding StandardDCL07-C. Include the appropriate type information in function declarators
 
Prior to 2018-01-12: CERT: Unspecified Relationship
ISO/IEC TR 24772:2013Subprogram Signature Mismatch [OTR]Prior to 2018-01-12: CERT: Unspecified Relationship
MISRA C:2012
 Rule
Rule 8.1 (required)Prior to 2018-01-12: CERT: Unspecified Relationship

Bibliography

[ISO/IEC 9899:1990]
 

[ISO/IEC 9899:
2011
2024]Subclause 6.7.
2
3, "Type Specifiers"
[Jones 2008]
 

...



...

Image Modified Image Modified Image Modified