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
At Except where the type is inferred (6.7.10), 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:
...
Tool | Version | Checker | Description | |||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Astrée |
| type-specifier function-return-type implicit-function-declaration undeclared-parameter | Fully checked | |||||||||||||||||||||||
Axivion Bauhaus Suite |
| CertC-DCL31 | Fully implemented | |||||||||||||||||||||||
Clang |
| -Wimplicit-int | ||||||||||||||||||||||||
Compass/ROSE | ||||||||||||||||||||||||||
Coverity |
| MISRA C 2012 Rule 8.1 | Implemented | |||||||||||||||||||||||
Cppcheck Premium |
| premium-cert-dcl31-c | Partially Implemented Can detect implicit int | |||||||||||||||||||||||
| CC2.DCL31 | Fully implemented | ||||||||||||||||||||||||
GCC |
| Can detect violations of this rule when the | ||||||||||||||||||||||||
Helix QAC |
| C0434, C2050, C2051, C3335 | Fully implemented | |||||||||||||||||||||||
Klocwork |
| CWARN.IMPLICITINT | Fully implemented | |||||||||||||||||||||||
LDRA tool suite |
| 24 D, 41 D, 20 S, 326 S, 496 S | Fully implemented | |||||||||||||||||||||||
Parasoft C/C++test |
| CERT_C-DCL31-a | All functions shall be declared before use | |||||||||||||||||||||||
PC-lint Plus |
| 601, 718, 746, 808 | Fully supported | |||||||||||||||||||||||
Polyspace Bug Finder |
| MISRA 2012 Rule 8.1 | Checks for:
| Types shall be
|
Rule fully covered. | |||||||||||||||||||||
PVS-Studio |
| PRQA QA
| C
| v
| PRQA QA
| C
| v0434 (C) | Fully implemented |
| V1031 | ||||||||||||||||
SonarQube C/C++ Plugin |
| S819, S820 | Partially implemented; implicit return type not covered. | |||||||||||||||||||||||
RuleChecker |
| type-specifier function-return-type implicit-function-declaration undeclared-parameter | Fully checked | |||||||||||||||||||||||
TrustInSoft Analyzer |
| 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.
...
[ISO/IEC 9899:1990] | |
[ISO/IEC 9899:20112024] | Subclause 6.7.23, "Type Specifiers" |
[Jones 2008] |
...