17-07-2026, 01:46 PM
The basic problem with A2-10-5 is that it implies that functions can have static storage duration, this is incorrect.
We think what was intended was that the name of functions with internal linkage should not be reused anywhere in the program, this includes both functions declared with the static keyword and those declared in an anonymous namespace (as of C++ 2011).
All the functions in your example have external linkage, so the rule does not apply, so your code is compliant.
As far as object declarations are concerned, the Autosar rule text is unambiguous and the rule applies to non-member objects with internal or external linkage.
We think what was intended was that the name of functions with internal linkage should not be reused anywhere in the program, this includes both functions declared with the static keyword and those declared in an anonymous namespace (as of C++ 2011).
All the functions in your example have external linkage, so the rule does not apply, so your code is compliant.
As far as object declarations are concerned, the Autosar rule text is unambiguous and the rule applies to non-member objects with internal or external linkage.
Posted by and on behalf of
the MISRA C++ Working Group
the MISRA C++ Working Group

