Main Content
AUTOSAR C++14 Rule M3-1-2
Functions shall not be declared at block scope
Description
Rule Definition
Functions shall not be declared at block scope.
Rationale
It is a good practice to place all declarations at the namespace level.
Additionally, if you declare a function at block scope, it is often not clear if the statement is a function declaration or an object declaration with a call to the constructor.
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, Automated |
Version History
Introduced in R2019a