Path: utzoo!mnetor!uunet!husc6!hao!oddjob!gargoyle!ihnp4!alberta!teletron!andrew From: andrew@teletron.UUCP (Andrew Scott) Newsgroups: comp.lang.c Subject: Re: exit(main(argc,argv,env)); Message-ID: <164@teletron.UUCP> Date: 21 Dec 87 18:21:06 GMT References: <10875@brl-adm.ARPA> <176@fxgrp.UUCP> <1286@laidbak.UUCP> <184@fxgrp.UUCP> Organization: TeleTronic Communications Ltd., Edmonton, Alta. Lines: 18 In article <184@fxgrp.UUCP>, ljz@fxgrp.UUCP (Lloyd Zusman, Master Byte Software) writes: But upon reflection, I have to agree that it is better to always use an exit() statement in main() instead of relying on return [ or even worse, using neither return nor exit(), as is often done ]. If even one C compiler doesn't use exit() with main() the way it is done in the GNU crt0 module, then you have unpredictable results if exit() is left out of main(). So, to be safe, always leave main() via exit(). Is it *really* better to use exit() instead of return from main()? Are there many compilers that don't do the same thing? The reason I ask is that it's always annoyed me that our lint doesn't understand exit() (and similar functions) and complains that "main() returns random value to invocation environment" if I don't use return. Andrew