Path: utzoo!attcan!uunet!aplcen!samsung!xanth!mcnc!rti!xyzzy!meissner From: meissner@dg-rtp.dg.com (Michael Meissner) Newsgroups: comp.unix.wizards Subject: Re: Why isn't argv[argc]==(char *)0 ? Message-ID: Date: 17 Nov 89 14:49:04 GMT References: <547.nlhp3@oracle.nl> Sender: usenet@xyzzy.UUCP Followup-To: comp.unix.wizards Organization: Data General (Languages @ Research Triangle Park, NC.) Lines: 37 In-reply-to: bengsig@oracle.nl's message of 15 Nov 89 16:23:27 GMT In article <547.nlhp3@oracle.nl> bengsig@oracle.nl (Bjorn Engsig) writes: | The execv family of system calls all have char *argv[] as their second | parameter, and you are required to put an endmarker as (char *)0 in it. | On the other hand, main has int argc and char *argv[] but here, the | endmarker has disappeared. Has it ever been considered to change the defi- | nition of main such that it will always be true that argv[argc] == (char *)0 | or to change the execv's to use argc and not an endmarker. | | Is it due to the fact that main() is a C-thing whereas exec() is a Unix thing, | and they therefore are incompatible? If this is the case, why isn't there a | system() counterpart in the scope of C with the same parameters as main()? | | It is probably much too late to change anything, but I would just like to | know if this has ever been considered. I don't know what version of the standard you are reading, but in the draft dated December 7, 1988, it states in section 2.1.2.2 on page 8: If they are defined, the parameters to the main function shall obey the following constraints: * The value of argc shall be nonegative. * argv[argc] shall be a null pointer. ... Note, this effectively rules out a ANSI C implementation on a Version 6 system (V6 for whatever reason, put -1 in argv[argc], and had a note in the exec* man pages that you couldn't pass argv to execve). I seriously doubt anybody is worried about this.... -- Michael Meissner, Data General. If compiles where much Uucp: ...!mcnc!rti!xyzzy!meissner faster, when would we Internet: meissner@dg-rtp.DG.COM have time for netnews?