home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / cplus / 13206 < prev    next >
Encoding:
Text File  |  1992-09-02  |  1.2 KB  |  32 lines

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