🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3245

Re: Must main return a value?

#3245
From: SQUID 6 on the DARK side
Date: Fri, 28 Jun 1991 07:25
41 lines
1800 bytes
In article <1991Jun28.043342.27540@ptcburp.ptcbu.oz.au>, michi@ptcburp.ptcbu.oz.au (Michael Henning) writes:
> walterm@hpwrce.HP.COM (Walter Murray) writes:
> 
>>Is the following program strictly conforming?
> 
>>   int main(void) { return; }
> 
>>Many people have written that the main function must return a value.
>>I can't find such a requirement in the Standard.  I have read 2.1.2.2.3
>>and 3.6.6.4.  Am I missing something?
>
>...stuff deleted...
>
> some (non-conforming) implementations to not return a defined value
> to the OS when a return from main is executed (even if that return
> specifies a value). So it pays to write
> 
> int main(void) { exit(0); }
> 
> to be sure. Unfortunately, many versions of lint will complain about
> an undefined return value from main in this case, because they do not
> know about exit(). If you want to be paranoid, you can write
> 
> int main(void)
> {
> 	exit(0);
> 	return 0;	/* Keep lint happy */
> }

	I've run into this problem running code on 3 platforms (VMS,SUN & PC)

I use:
	void main()
	{
	insert magic code here
	}

This seems to work well on all three platforms.


			Mark  <o===6
Technical Details
Message-ID: <1991Jun28.072521.1@sysjj.mdcbbs.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!ccu.umanitoba.ca!herald.usask.ca!alberta!brazeau.ucs.ualberta.ca!unixg.ubc.ca!ubc-cs!uw-beaver!zephyr.ens.tek.com!uunet!sysjj.mdcbbs.com!hooverm
References: <7830001@hpwrce.HP.COM> <1991Jun28.043342.27540@ptcburp.ptcbu.oz.au>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!ccu.umanitoba.ca!herald.usask.ca!alberta!brazeau.ucs.ualberta.ca!unixg.ubc.ca!ubc-cs!uw-beaver!zephyr.ens.tek.com!uunet!sysjj.mdcbbs.com!hooverm
From: hooverm@sysjj.mdcbbs.com (SQUID 6 on the DARK side)
Newsgroups: comp.std.c
Subject: Re: Must main return a value?
Message-ID: <1991Jun28.072521.1@sysjj.mdcbbs.com>
Date: 28 Jun 91 07:25:21 GMT
References: <7830001@hpwrce.HP.COM> <1991Jun28.043342.27540@ptcburp.ptcbu.oz.au>
Organization: McDonnell Douglas M&E, Cypress CA
Lines: 41
Nntp-Posting-Host: sysjj
Nntp-Posting-User: hooverm