MISRA C++:2008 Rule 3-3-2
If a function has internal linkage then all re-declarations shall include the
static
storage class specifier
Description
Rule Definition
If a function has internal linkage then all re-declarations shall include the
static
storage class specifier.
Rationale
If a function declaration uses the static
storage class specifier, it
has internal linkage. Subsequent redeclarations of the function have internal linkage even
without the static
specifier.
However, if you do not specify the static
keyword explicitly,
it is not immediately clear from a declaration whether the function has internal
linkage.
Polyspace Implementation
Polyspace® reports a violation if you declare a function with static
linkage and but their redeclaration has external linkage.
For details about which objects and functions have external linkage, see Storage class specifiers.
Troubleshooting
If you expect a rule violation but Polyspace does not report it, see Diagnose Why Coding Standard Violations Do Not Appear as Expected.
Examples
Check Information
Group: Basic Concepts |
Category: Required |
Version History
Introduced in R2013b