Path: utzoo!attcan!uunet!aplcen!samsung!usc!apple!sun-barr!lll-winken!decwrl!shelby!helens!relgyro!mike From: mike@relgyro.stanford.edu (Mike Macgirvin) Newsgroups: comp.lang.c Subject: Re: (* func)(fred, bert) Message-ID: <374@helens.Stanford.EDU> Date: 14 Nov 89 22:43:23 GMT References: <2387@stl.stc.co.uk> <744@lakart.UUCP> <0175@sheol.UUCP> <812@bbm.UUCP> <11592@smoke.BRL.MIL> Sender: news@helens.STANFORD.EDU Reply-To: mike@relgyro.STANFORD.EDU (Mike Macgirvin) Organization: Stanford Relativity Gyro Experiment (GP-B) Lines: 44 In article <11592@smoke.BRL.MIL> gwyn@brl.arpa (Doug Gwyn) writes: >In article <812@bbm.UUCP> darcy@druid.UUCP (D'Arcy J.M. Cain) writes: >>In article <0175@sheol.UUCP> throopw@sheol.UUCP (Wayne Throop) writes: >>>> dg@lakart.UUCP (David Goodenough) >>>> void main() >>>It is well worth mentioning (again) that it is NOT a good idea >>So what? If you exit your program through some cleanup routine (perhaps >Wayne's right and you're wrong. In a hosted environment main() has OK, this thing has my head spinning. I use Microsoft 'C' with full warnings. I do something easy like: #include #include int main(void) { (void) printf("Hello world\n"); exit(0); } And the darn thing complains that I'm not returning a value. So in order to make the compiler shut up, I have to: #include #include int main(void) { (void) printf("Hello world\n"); exit(0); /* NOT REACHED */ return(0); } This seems like a heck of an overkill to produce 'hello.c' without any warnings. So how do YOU 'exit' a program? Granted, in SOME implementations, a 'return' from main places the return value in the program's exit status, but I'm not sure that it is universal. I thought that was was 'exit' was for. I realize what the compiler is complaining about, but the solution seems to be bad coding practice. (My Unix compiler will cough on the above with a 'Statement not reached' warning...). Any thoughts? ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + Mike Macgirvin Relativity Gyroscope Experiment (GP-B) + + mike@relgyro.stanford.edu (36.64.0.50) + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++