Main Content
AUTOSAR C++14 Rule M7-3-2
The identifier main shall not be used for a function other than the global function main
Description
Rule Definition
The identifier main shall not be used for a function other than the global function main.
Rationale
Typically, the main
function lives in the global namespace and acts as the entry point to a program. The use of main
in other contexts might defy developer expectations.
Polyspace Implementation
The rule checker reports a violation if you use the identifier main
in a namespace other than the global namespace.
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: Declaration |
Category: Required, Automated |
Version History
Introduced in R2019a