sqc 0.4.13

Software Code Quality - CERT C compliance checker
[metadata]
id = "DCL01-C"
type = "recommendation"
category = "DCL"
number = 1
title = "Do not reuse variable names in subscopes"
description = """
Do not use the same variable name in two scopes where one scope is contained in
another. For example, Reusing variable names leads to programmer confusion about
which variable is being modified. Additionally, if variable names are reused,
generally one or both of the variable names are too generic. This noncompliant
code example declares themsgidentifier at file scope and reuses the same
identifier to declare a character array local to thereport_error()function. The
programmer may unintentionally copy the function argument to the locally
declaredmsgarray within thereport_error()function. Depending on the programmer's
intention, it either fails to initialize the global variablemsgor allows the
localmsgbuffer to overflow by using the global valuemsgsizeas a bounds for the
local buffer.
"""
severity = "Low"
likelihood = "Unlikely"
priority = "P3"
level = "L3"
cert_version = "2016 Edition (Wiki)"
last_modified = "Oct 29, 2025"

[rules.cert_c.DCL01-C]
enabled = true

[references]
wiki = "https://wiki.sei.cmu.edu/confluence/display/c/DCL01-C.+Do+not+reuse+variable+names+in+subscopes"