consistency - conventional
Why is this an issue?
A global function named main
is 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.
Noncompliant code example
int main() { // Compliant
}
namespace {
int main() { // Noncompliant
}
}
namespace NS {
int main() { // Noncompliant
}
}
Resources
- MISRA C++:2008, 7-3-2 - The identifier main shall not be used for a function other than global function main.