From mboxrd@z Thu Jan 1 00:00:00 1970 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> Date: Thu, 26 Apr 2001 12:17:47 -0700 Topicbox-Message-UUID: 922cdc6a-eac9-11e9-9e20-41e7f4b1d025 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".