int main(int argc, char** argv)
int main(const int argc, char const * const * const argv)
Any non-obvious theorems are to be proved as homework.
ISO/EIC 14882 3.6.1 2... It [main function] shall have a return type of type int, but otherwise its type is implementation-defined. All implementations shall allow both of the following definitions of main:
int main() { /* ... */ }andint main(int argc, char* argv[]) { /* ... */ }
Does holy ISO/EIC 14882 really say evil is omnipresent and doom inevitable?!
That was real close but hell no!
Hidden in large tome of ISO/EIC 14882 is the magical fine-print: const
in function signature does not count when function type matters.
ISO/EIC 14882:1998 8.3.5 3... The type of a function is determined using the following rules. The type of each parameter is determined from its own decl-specifier-seq and declarator. ... Any cv-qualifier modifying a parameter type is deleted. [Example: the type void(*)(const int) becomes void(*)(int) -end example] Such cv-qualifiers affect only the definition of the parameter within the body of the function; they do not affect the function type. ...
ISO/EIC 14882:2011 8.3.5 5Since... After producing the list of parameter types, any top-level cv-qualifiers modifying a parameter type are deleted when forming the function type. ...
const
qualifiers are effectively ignored here const-correct main() function with arguments signature is compliant with standard prescribed signature.