Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!samsung!aplcen!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: main() - argc,argv Message-ID: <11714@smoke.BRL.MIL> Date: 1 Dec 89 00:03:03 GMT References: <1093@nsscb.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 21 In article <1093@nsscb.UUCP> nrg@nsscb.UUCP (G.Narotham Reddy) writes: >I would like to know what happens if main() is passed more than two arguments? It depends on details of the implementation. Some UNIX systems actually have done this; on those systems one may have to define main() with three arguments in order to obtain correct linkage with the run-time startoff module. X3J11 decided that this was an unwarranted change to a fundamental hosted-C interface and would not be sanctioned by the C Standard. IEEE P1003 had at one time intended to follow UNIX System V's lead in this, but the problems were pointed out and they backed down on it. (Unfortunately, the alternative hook for the extra information, a global variable called "environ", was not dealt with properly by the combination of X3J11 and P1003, causing much last-minute scrambling to try to maintain 1003.1/X3.159 compatibility.) Note that there have been a series of type compatibility screw-ups by AT&T UNIX developers in the past, including relying on a -1 "value" (ill-defined) for pointers as a portable error indicator. I don't know why these happened, since I KNOW there were individuals within Bell Labs who could have given proper advice on these matters.