sqc 0.4.13

Software Code Quality - CERT C compliance checker
[metadata]
id = "DCL38-C"
type = "rule"
category = "DCL"
number = 38
title = "Use the correct syntax when declaring a flexible array member"
description = """
Flexible array members are a special type of array in which the last element of
a structure with more than one named member has an incomplete array type; that
is, the size of the array is not specified explicitly within the structure. This
"struct hack" was widely used in practice and supported by a variety of
compilers. Consequently, a variety of different syntaxes have been used for
declaring flexible array members. For conforming C implementations, use the
syntax guaranteed to be valid by the C Standard. Flexible array members are
defined in the C Standard, 6.7.3.2, paragraph 20 [ISO/IEC 9899:2024], as
follows: Structures with a flexible array member can be used to produce code
with defined behavior. However, some restrictions apply:
"""
severity = "Low"
likelihood = "Unlikely"
priority = "P3"
level = "L3"
cert_version = "2016 Edition (Wiki)"
last_modified = "May 06, 2025"

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

[references]
wiki = "https://wiki.sei.cmu.edu/confluence/display/c/DCL38-C.+Use+the+correct+syntax+when+declaring+a+flexible+array+member"