Path: utzoo!attcan!uunet!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!mips!pacbell.com!pacbell!barn!everexn!roger From: roger@everexn.uucp (Roger House) Newsgroups: comp.lang.c Subject: Re: main() arguments, was Re: typedef-ing an array Message-ID: <1990Jul5.190256.5483@everexn.uucp> Date: 5 Jul 90 19:02:56 GMT References: <78627@srcsip.UUCP> <78633@srcsip.UUCP> <25247@mimsy.umd.edu> <4238@jato.Jpl.Nasa.Gov> Organization: Everex Systems, Inc. Lines: 21 In <4238@jato.Jpl.Nasa.Gov> kaleb@mars.jpl.nasa.gov (Kaleb Keithley) writes: >Second bone to pick is the assertion that main() has two arguments (???) >Since when? What about the third allowable argument; envp? I know that >both UNIX and DOS (M'soft C compilers anyway) support char **envp (or >char *envp[] if you will) as the third parameter to main. According to p11 of the Rationale for ANSI C: main is the only function that may portably be declared either with zero or two arguments. (The number of arguments must or- dinarily match exactly between invocation and definition.) This special case simply recognizes the widespread practice of leaving off the arguments to main when the program does not access the program argument strings. While many implementations support more than two arguments to main, such practice is neither blessed nor forbidden by the Standard; a program that defines main with three arguments is not *strictly conforming*. Roger House