AutosarC++17_03-M7.3.2¶
The identifier main shall not be used for a function other than the global function main
Required inputs: IR
| Level | required |
|---|---|
| Target | implementation |
| Enforcement | automated |
[Implementation 3.6.1(2, 3)]
Rationale
main (or its equivalent) is usually the entry point to the program and is the only identifier which must be in the global namespace. The use of main for other functions may not meet developer expectations.
Example
int32_t main ( ) // Compliant
{
}
namespace
{
int32_t main ( ) // Non-compliant
{
}
}
namespace NS
{
int32_t main ( ) // Non-compliant
{
}
}
Note
For legal reasons, this rule’s description is not part of the public documentation.