From: "A. Sinan Unur" Newsgroups: comp.os.msdos.djgpp Subject: Re: void main ? Date: Thu, 03 Jul 1997 17:51:40 -0400 Organization: Cornell University http://www.cornell.edu Lines: 34 Sender: asu1 AT cornell DOT edu (Verified) Message-ID: <33BC1EEC.6B36@cornell.edu> References: <33BBB7F9 DOT 7990BD53 AT alcyone DOT com> Reply-To: asu1 AT cornell DOT edu NNTP-Posting-Host: cu-dialup-0011.cit.cornell.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Erik Max Francis wrote: > > Giovanni Resta wrote: > > > I always declared main as void in the past 5 years and > > I never get an error, so I'm curious about the topic. > > (I must admit that I never had to test the 'exit code' of a program, > > maybe that can change things) > > There are only two valid ANSI C prototypes for main: > > int main(void); > int main(int argc, char *argv[]); /* the names of the arguments can > vary, of course */ > > This is clearly indicated in section 5.1.2.2.1 of the ANSI C standard. > also, the draft C++ standard only specifies that the return type of main shall be int and it should support at least the two froms given above. so to be conforming, you must use int main (at least for hosted applications.) -- Sinan ******************************************************************* A. Sinan Unur WWWWWW |--O+O mailto:sinan DOT unur AT cornell DOT edu C ^ http://www.people.cornell.edu/pages/asu1/ \ ~/ Unsolicited e-mail is _not_ welcome, and will be billed for. *******************************************************************