View Single Post
  #5 (permalink)  
Old August 2nd, 2003, 08:36 PM
7stud 7stud is offline
Authorized User
 
Join Date: Jul 2003
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:
void main(void)
||
void main()

Are premissable C++ entry points.
Apparently many people do not agree with you:

What is correct: "void main()" or "int main()"?

According to the ANSI/ISO standard, the correct forms are two:

int main() { /* ... */ }
int main(int argc, char* argv[]) { /* ... */ }

Even though "void main()" will probably compile (depends on the compiler), it is not correct!

http://www.cpp-home.com/
--------------

void main(void) - the Wrong Thing

http://users.aber.ac.uk/auj/voidmain.shtml

-----------------

void main() is not legal in C++ but is legal in C.
You've come to this page because you've said something similar to
void main() is not legal in the C language. main() is required to return int.
This is the Frequently Given Answer to that false assertion.

The ISO C++ Standard (ISO/IEC 14882:1998) specifically requires main to return int. But the ISO C Standard (ISO/IEC 9899:1999) actually does not. This comes as a surprise to many people. But despite what many documents say, including the Usenet comp.lang.c FAQ document (at great length), the actual text of the C Standard allows for main returning other types.

In my opinion, this is a defect in the C Standard that needs fixing with a corrigendum.

http://homepages.tesco.net/~J.deBoyn...void-main.html
----------------

http://www.delorie.com/djgpp/v2faq/faq22_25.html

-----

http://faq.cprogramming.com/cgi-bin/...&id=1043284376

Reply With Quote