home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!taumet!steve
- From: steve@taumet.com (Steve Clamage)
- Subject: Re: Turbo C++, function prototypes
- Message-ID: <1992Sep2.162728.11201@taumet.com>
- Organization: TauMetric Corporation
- References: <1992Aug31.181755.13060@hou.amoco.com> <2262@bigfoot.first.gmd.de> <1992Sep1.160816.10309@lclark.edu>
- Date: Wed, 2 Sep 1992 16:27:28 GMT
- Lines: 21
-
- harrison@lclark.edu (Mark Harrison) writes:
-
- >>main's correct return type is 'int'.
-
- >It should make no difference whether you try 'int' or 'void' as long as
- >main() returns the correct value (or doesn't with void.)
-
- It ought to make a difference, since the only valid definitions of
- main() have return type 'int' (explict or implied). This is the case
- in both Standard C and in C++. If you write, for example,
- void main(){ }
- The compiler is obligated to diagnose an error in C and C++.
-
- The return value from main() is supposed to be supplied to the calling
- environment in some implementation-defined way. Some systems appear not
- to care whether you return a value, but some report error conditions
- based on the garbage value which main() otherwise implicitly returns.
- --
-
- Steve Clamage, TauMetric Corp, steve@taumet.com
- Vice Chair, ANSI C++ Committee, X3J16
-