Path: utzoo!mnetor!uunet!husc6!hao!oddjob!gargoyle!ihnp4!laidbak!daveb From: daveb@laidbak.UUCP (Dave Burton) Newsgroups: comp.lang.c Subject: Re: exit(main(argc,argv,env)); Message-ID: <1286@laidbak.UUCP> Date: 18 Dec 87 06:38:12 GMT References: <10875@brl-adm.ARPA> <176@fxgrp.UUCP> Reply-To: daveb@laidbak.UUCP (Dave Burton) Organization: is pretty bad/My method of Lines: 34 In article <176@fxgrp.UUCP> fxgrp!ljz@ames.arpa (Lloyd Zusman, Master Byte Software) writes: >In article <10875@brl-adm.ARPA> ADLER1%BRANDEIS.BITNET@CUNYVM.CUNY.EDU writes: >>... >>found the command >>exit(main(argc,argv,env)); >>which I find puzzling. ... > ... > return(99); > ... >This is supposed to be equivalent to > ... > exit(99); > ... >I say "supposed to" because I've used C compilers on the IBM PC where >this doesn't work. They are NOT equivalent! At least in the UNIX environment, exit() is a function that flushes all buffers (and closes all file descriptors?), as well as handling functions registered via onexit(), finally calling _exit(), a system call that never returns. Using return instead of exit() bypasses this cleanup operation. -- --------------------"Well, it looked good when I wrote it"--------------------- Verbal: Dave Burton Net: ...!ihnp4!laidbak!daveb V-MAIL: (312) 505-9100 x325 USSnail: 1901 N. Naper Blvd. #include Naperville, IL 60540