Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!snorkelwacker!usc!zaphod.mps.ohio-state.edu!sdd.hp.com!elroy.jpl.nasa.gov!jato!mars!kaleb From: kaleb@mars.jpl.nasa.gov (Kaleb Keithley) Newsgroups: comp.lang.c Subject: main() arguments, was Re: typedef-ing an array Message-ID: <4238@jato.Jpl.Nasa.Gov> Date: 3 Jul 90 16:53:18 GMT References: <78627@srcsip.UUCP> <78633@srcsip.UUCP> <25247@mimsy.umd.edu> Sender: news@jato.Jpl.Nasa.Gov Reply-To: kaleb@mars.UUCP (Kaleb Keithley) Organization: Jet Propulsion Laboratory, Pasadena, CA. Lines: 29 In article <25247@mimsy.umd.edu> chris@mimsy.umd.edu (Chris Torek) writes: >The first error is `void main': it must (yes must) be `int main', even >if it never returns. It may have either 0 arguments or two (int argc, >char *argv). I have a bone to pick here. K&R 2nd Ed. states (p. 26): A function need not return a value. [...] Since main is a function like any other, it may return a value to its caller... Furthermore, on p. 164 (Ibid.) it is stated: Within main, return expr is equivalent to exit(expr). exit has the advantage... If exit() is used rather than return, I submit that declaring main as returning type void is not only legal, but correct, as lint plus ANSI compilers will complain that there is no return statement. 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. kaleb@thyme.jpl.nasa.gov Jet Propeller Labs Kaleb Keithley "So that's what an invisible barrier looks like"