[metadata]
id = "DCL31-C"
type = "rule"
category = "DCL"
number = 31
title = "Declare identifiers before using them"
description = """
The 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 animplementationmay 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:2024], states This noncompliant code
example omits the type specifier:
"""
severity = "Low"
likelihood = "Unlikely"
priority = "P3"
level = "L3"
cert_version = "2016 Edition (Wiki)"
last_modified = "Aug 06, 2025"
[rules.cert_c.DCL31-C]
enabled = true
[references]
wiki = "https://wiki.sei.cmu.edu/confluence/display/c/DCL31-C.+Declare+identifiers+before+using+them"