Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!cornell!uw-beaver!teknowledge-vaxc!sri-unix!quintus!ok From: ok@quintus.UUCP (Richard A. O'Keefe) Newsgroups: comp.lang.c Subject: Re: How big is the argv[] array? Message-ID: <507@quintus.UUCP> Date: 6 Oct 88 00:00:40 GMT References: <1239500004@osiris.cso.uiuc.edu> <8631@smoke.ARPA> <4206@bsu-cs.UUCP> Reply-To: ok@quintus.UUCP (Richard A. O'Keefe) Organization: Quintus Computer Systems, Inc. Lines: 31 In article <4206@bsu-cs.UUCP> dhesi@bsu-cs.UUCP (Rahul Dhesi) writes: >In article <8631@smoke.ARPA> gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) writes: >>argv[argc] is supposed to be a null pointer... >Since this is comp.lang.c and not a UNIX newsgroup, the following >footnote from "Advanced UNIX Programming" by Marc J. Rochkind (p 105) >is relevant: > > "The C Programming Language" does not state anywhere that argv[argc] > is NULL. Neither do most UNIX manuals. The System V Interface Definition says (Vol 1, Page 71, 1st paragraph) "argv is terminated by a null pointer", and "envp is terminated by a null-pointer". The 4.2BSD manual page says "the array of pointers is terminated by a null pointer". The VAX-11 C manual (for VMS) says on page 24-5 "The last element of [argv] is always the null pointer (0).", and "The last element in envp must be the null pointer (0)." On IBM mainframes, SAS Lattice C (C-101, p 4.6) says that "argv[argc] is 0" and the IBM C Compiler reference manual says on page 8.3 that there is a null pointer after the arguments in argv[]. (It should be noted that the SAS manual gives an example of calling C from Fortran which violates this convention, but that example also violates the convention that the elements of argv[] are pointers to strings.) So, assuming that !argv[argc] is portable between System V, 4.2, VMS, and IBM mainframes. Which are the implementations of C where argv[] is present but argv[argc] is not defined?