Topic: Does "main()" always return an int ! T V Y a c f g j x


Author: comeau@panix.com (Greg Comeau)
Date: 1998/01/19
Raw View
In article <01bd23be$33c440e0$480b48a6@aptiva> "Don R. O'Brien" <drobri@ibm.net> writes:
>I have a question for the group.  Does "main()" always return an int ?  In
>Microsoft Visual C++ "main()" is allowed to return void.  Some books on C++
>programming also use the "void main()" function definition.  Solaris C++
>and Borland C++ 5.0 seem only to mention the "int main()" function
>definition.  The ARM book also only mentions the "int main()" function
>definition.
>
>So what does the new C++ standard say?  How is "main()" defined ?

Many compilers will allow other return types, most namely void,
but main() is supposed to return int.

- Greg
--
       Comeau Computing, 91-34 120th Street, Richmond Hill, NY, 11418-3214
               Producers of Comeau C++ 4.0 front-end pre-release
****WEB: http://www.comeaucomputing.com / Voice:718-945-0009 / Fax:718-441-2310
 Here:comeau@comeaucomputing.com / BIX:comeau or comeau@bix.com / CIS:72331,3421
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu
]