The C++ standard allows one of the following signatures:
int main()int main(int argc, char* argv[])
And why the extra (void) ? Just curious...
int main()int main(int argc, char* argv[])
Quote:Original post by Konfusius
Yes it works (on some compilers), but it's not valid C++ nor C.
Quote:Original post by rpg_code_masterQuote:Original post by Konfusius
Yes it works (on some compilers), but it's not valid C++ nor C.
I agree with that. I guess I should change [smile]
Quote:Original post by rpg_code_masterQuote:Original post by Konfusius
BTW, (sorry can't resist :P) there has never been a void main().
And I am curious to know what an explicit void parameter should communicate...
It works, I use it all the time.
I just double tested on Visual Studio 2005 here at work, and it runs fine.
Quote:
ISO14882(C++ standard) section 3.6.1.2
An implementation shall not define the main function. The function shall not be overloaded. It shall have a return type of int but otherwise it's type is implementation defined. All implementations shall allow both of the following definitions of main:
int main() { /*...*/ }
int main(int argc, char* argv[]) { /*...*/ }
Quote:Original post by KonfusiusIt's an old C thing. In C, before the C99 (Or Csomething) standard, any function not taking any arguments had to be declared as return_type function_name(void).
And why the extra (void) ? Just curious...
Quote:Original post by Evil SteveQuote:Original post by KonfusiusIt's an old C thing. In C, before the C99 (Or Csomething) standard, any function not taking any arguments had to be declared as return_type function_name(void).
And why the extra (void) ? Just curious...