9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: forsyth@caldo.demon.co.uk
To: 9fans@cse.psu.edu
Subject: Re: [9fans] the declaration of main()
Date: Thu, 26 Apr 2001 21:58:55 +0100	[thread overview]
Message-ID: <20010426210148.4FA2719A2B@mail.cse.psu.edu> (raw)

[-- Attachment #1: Type: text/plain, Size: 561 bytes --]

>>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.


[-- Attachment #2: Type: message/rfc822, Size: 2218 bytes --]

From: Mike Haertel <mike@ducky.net>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] the declaration of main()
Date: Thu, 26 Apr 2001 12:17:47 -0700 (PDT)
Message-ID: <200104261917.f3QJHlG03409@ducky.net>

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".

             reply	other threads:[~2001-04-26 20:58 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-26 20:58 forsyth [this message]
2001-04-27  9:13 ` Douglas A. Gwyn
2001-04-27 14:48   ` Boyd Roberts
2001-04-27 16:22     ` Douglas A. Gwyn
2001-04-27 18:24       ` William K. Josephson
2001-04-30  9:23         ` Douglas A. Gwyn
2001-04-27 19:38       ` Boyd Roberts
2001-04-28 15:54       ` Greg Hudson
2001-04-28 16:39         ` Dan Cross
2001-04-28 17:06           ` Boyd Roberts
2001-04-30  9:25           ` Douglas A. Gwyn
  -- strict thread matches above, loose matches on Subject: below --
2001-04-30 12:05 rob pike
2001-04-30 10:44 forsyth
2001-04-28 18:44 forsyth
2001-04-30  9:24 ` Douglas A. Gwyn
2001-04-28 17:57 forsyth
2001-04-28 22:28 ` Dan Cross
2001-04-30  9:25 ` Douglas A. Gwyn
2001-04-27  6:57 nemo
2001-04-26 19:42 Russ Cox
2001-04-26 20:32 ` Dan Cross
2001-04-26 22:03 ` Boyd Roberts
2001-04-27  9:13 ` Douglas A. Gwyn
2001-04-26 18:23 forsyth
2001-04-26 19:17 ` Mike Haertel
2001-04-26 23:50   ` Boyd Roberts
2001-04-27 14:41     ` Douglas A. Gwyn
2001-04-27 15:40       ` Boyd Roberts
2001-04-27  9:12 ` Douglas A. Gwyn
2001-04-24 10:32 rog
2001-04-24 18:03 ` Steve Kilbane
2001-04-24  8:10 forsyth
2001-04-26 15:55 ` Douglas A. Gwyn
2001-04-24  0:59 okamoto
2001-04-24  3:08 ` Boyd Roberts
2001-04-23 19:33 dmr
2001-04-23 11:09 forsyth
2001-04-23 11:31 ` Boyd Roberts
2001-04-24  9:02 ` Douglas A. Gwyn
2001-04-24 12:09   ` Boyd Roberts
2001-04-26 16:05     ` Douglas A. Gwyn
2001-04-26 18:12       ` Boyd Roberts
2001-04-26 23:55       ` Boyd Roberts
2001-04-24 17:43   ` Greg Hudson
2001-04-26 15:55     ` Douglas A. Gwyn
2001-04-12  6:28 okamoto
2001-04-23  8:44 ` Douglas A. Gwyn
2001-04-23  8:48 ` Boyd Roberts
2001-04-12  6:22 YAMANASHI Takeshi
2001-04-12  6:25 ` andrey mirtchovski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010426210148.4FA2719A2B@mail.cse.psu.edu \
    --to=forsyth@caldo.demon.co.uk \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).