🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.c
Article #9450

Re: functions that don't return

#9450
From: Chris Torek
Date: Wed, 01 Oct 1986 05:14
22 lines
1323 bytes
In article <584@hadron.UUCP> jsdy@hadron.UUCP (Joseph S. D. Yao) writes:
>Using 'return' from main() is the preferred way to exit according
>to System V lint (which complains otherwise). ...
>but comments on s5lint's and others' mental models welcome.

Someone at Sun must have had a different model indeed, for alas,
in at least one major release, their startup code amounts to this:

	push argc, argv, envp
	call main
	push 0
	call exit

This means that

    main( ... ) ... return (EX_USAGE); ...

will return not exit code 64, but rather code 0 (success).
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 1516)
UUCP:	seismo!umcp-cs!chris
CSNet:	chris@umcp-cs		ARPA:	chris@mimsy.umd.edu
Technical Details
Message-ID: <3637@umcp-cs.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!caip!think!nike!lll-crg!seismo!umcp-cs!chris
References: <28@tl-vaxa.UUCP> <86900066@haddock> <584@hadron.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!caip!think!nike!lll-crg!seismo!umcp-cs!chris
From: chris@umcp-cs.UUCP (Chris Torek)
Newsgroups: net.lang.c
Subject: Re: functions that don't return
Message-ID: <3637@umcp-cs.UUCP>
Date: Wed, 1-Oct-86 01:14:01 EDT
Article-I.D.: umcp-cs.3637
Posted: Wed Oct  1 01:14:01 1986
Date-Received: Fri, 3-Oct-86 08:39:06 EDT
References: <28@tl-vaxa.UUCP> <86900066@haddock> <584@hadron.UUCP>
Reply-To: chris@umcp-cs.UUCP (Chris Torek)
Organization: University of Maryland, Dept. of Computer Sci.
Lines: 22