Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!samsung!rex!uflorida!bp@swamp.cis.ufl.edu From: bp@swamp.cis.ufl.edu (Brian Pane) Newsgroups: comp.lang.c++ Subject: Flames re: Can you prototype main() ????? Message-ID: <24449@uflorida.cis.ufl.EDU> Date: 17 Sep 90 01:02:28 GMT Sender: news@uflorida.cis.ufl.EDU Organization: UF CIS Dept. Lines: 21 I've already received one kind e-mail response correcting my earlier posting on the permissibility of prototyping "int main();," and I hope people will read this before wasting the bandwith with flames to the newsgroup. My point, though perhaps not well stated, was that the declaration "int main();" would clash with the definition "int main(int argc, char* argv[]) {} ." Yes, you can get away with "int main(); int main() {}," with g++ anyway, but the actual parameters corresponding to argc and argv are still there. (Assuming that that's how your OS works, assuming that the system even has an OS, etc.) The only reason you'd want to prototype main() is to call it from somewhere else; in such a case, it ought to be called with the right arguments, though a main defined as "int main() { /* ... */ }" wouldn't attempt to access any arguments anyway, so it wouldn't really matter that argc and argv were placed on the stack only before the first invocation of main. -Brian Pane