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
}
}