From mboxrd@z Thu Jan 1 00:00:00 1970 To: 9fans@cse.psu.edu Subject: Re: [9fans] the declaration of main() From: forsyth@caldo.demon.co.uk MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="upas-wwdwfeorqjjmjflwmfljmuldfu" Message-Id: <20010426210148.4FA2719A2B@mail.cse.psu.edu> Date: Thu, 26 Apr 2001 21:58:55 +0100 Topicbox-Message-UUID: 92400a24-eac9-11e9-9e20-41e7f4b1d025 This is a multi-part message in MIME format. --upas-wwdwfeorqjjmjflwmfljmuldfu Content-Disposition: inline Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit >>Note that Forsyth's example is from 6th edition Unix, not 7th edition. >>(The "s4/" in the source file name is a dead giveaway.) i'm afraid not. >>C didn't really become widely used until after the 7th edition, and >>v7 C is really the ancestral root of most other implementations. It is the C compilers knew nothing of main, and if 7th edition really was the ancestral root of most other implementations (which isn't so, because there were some before 7th edition), they wouldn't have needed the invention of EXIT_FAILURE and EXIT_SUCCESS. --upas-wwdwfeorqjjmjflwmfljmuldfu Content-Type: message/rfc822 Content-Disposition: inline Received: from finch-punt-12.mail.demon.net ([194.217.242.36]) by lavoro; Thu Apr 26 20:29:50 BST 2001 Received: from punt-1.mail.demon.net by mailstore for forsyth@caldo.demon.co.uk id 988313338:10:27145:6; Thu, 26 Apr 2001 19:28:58 GMT Received: from psuvax1.cse.psu.edu ([130.203.4.6]) by punt-1.mail.demon.net id aa1103887; 26 Apr 2001 19:28 GMT Received: from psuvax1.cse.psu.edu (psuvax1.cse.psu.edu [130.203.6.6]) by mail.cse.psu.edu (CSE Mail Server) with ESMTP id 7F30119A2C; Thu, 26 Apr 2001 15:28:18 -0400 (EDT) Received: from ducky.net (gate.ducky.net [199.2.211.252]) by mail.cse.psu.edu (CSE Mail Server) with ESMTP id E099A199DC for <9fans@cse.psu.edu>; Thu, 26 Apr 2001 15:27:12 -0400 (EDT) Received: (from mike@localhost) by ducky.net (8.11.3/8.11.1) id f3QJHlG03409 for 9fans@cse.psu.edu; Thu, 26 Apr 2001 12:17:47 -0700 (PDT) (envelope-from mike) From: Mike Haertel Message-Id: <200104261917.f3QJHlG03409@ducky.net> To: 9fans@cse.psu.edu Subject: Re: [9fans] the declaration of main() In-Reply-To: <20010426182650.3DDB3199D7@mail.cse.psu.edu> Sender: 9fans-admin@cse.psu.edu Errors-To: 9fans-admin@cse.psu.edu X-BeenThere: 9fans@cse.psu.edu X-Mailman-Version: 2.0.1 Precedence: bulk Reply-To: 9fans@cse.psu.edu List-Id: Fans of the OS Plan 9 from Bell Labs <9fans.cse.psu.edu> List-Archive: Date: Thu, 26 Apr 2001 12:17:47 -0700 (PDT) Forsyth wrote: >cpu% cat s4/crt0.s >/ C runtime startoff Note that Forsyth's example is from 6th edition Unix, not 7th edition. (The "s4/" in the source file name is a dead giveaway.) Here's the corresponding code fragment from 7th edition /usr/src/libc/csu/crt0.s: 1: mov r0,4(sp) mov r0,_environ jsr pc,_main cmp (sp)+,(sp)+ mov r0,(sp) jsr pc,*$_exit sys exit Here the int return value from main does indeed become the exit status. C didn't really become widely used until after the 7th edition, and v7 C is really the ancestral root of most other implementations. It is also the version of the language that most nearly coincided with the publication of the 1st edition of "The C Programming Language". --upas-wwdwfeorqjjmjflwmfljmuldfu--