Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!rice!rice!sun-spots-request From: gbarker@mph.sm.ucl.ac.uk (Dr Gareth J. Barker) Newsgroups: comp.sys.sun Subject: Re: exit() and return() in a C program (SUMM Keywords: Miscellaneous Message-ID: <1990Aug14.232507.16557@rice.edu> Date: 13 Aug 90 13:14:49 GMT Sender: sun-spots-request@rice.edu Organization: Sun-Spots Lines: 43 Approved: Sun-Spots@rice.edu Originator: spots@titan.rice.edu X-Sun-Spots-Digest: Volume 9, Issue 304, message 3 X-Refs: Original: v9n298 The answer to my question : was that main is implicitely defined as returning an int (since I hadn't defined it as anything else) and lint therefore wanted to se it return an int at the end any path through the routine. Since it doesn't know that exit() never returns it give an error message when it 'drops off the end' of the function. The solution is either to change the code to: main() { exit(0); return(0); } where the return() statement will never be reached but will keep lint happy, or, more cleanly: main() { exit(0); /*NOTREACHED*/ } Thanks to: kucharsk@com.solbourne cudcv@uk.ac.warwick.cu sanzgiri%flamingo.meta steve@com.taumet cgwst@edu.pitt.cis.uni guy@com.auspex scl@edu.virginia.acc.s cs@com.sun.eng lwv27@EARN.CAS (David Moore)moore%ess hue%island@com.sun Gareth J. Barker, Institute of Neurology, Queen Square, London, UK. JANET : gbarker@uk.ac.ucl.sm.mph INTERNET : gbarker@.mph.sm.ucl.ac.uk BITNET : gbarker%uk.ac.ucl.sm.mph@ukacrl.bitnet