Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!mailrus!purdue!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: Turbo C atexit function. Message-ID: <10426@smoke.BRL.MIL> Date: 21 Jun 89 20:31:33 GMT References: <166@enuxha.eas.asu.edu> <22420@iuvax.cs.indiana.edu> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 14 In article <22420@iuvax.cs.indiana.edu> bobmon@iuvax.cs.indiana.edu (RAMontante) writes: >... Doug Gwyn's comment about main()'s return value can also >be finessed by declaring it as > void main(void) >[I don't know if this is legitimate, but it silences the warning messages.] No, it's not legitimate. The goal should not be to "silence warning messages", but to produce a correct program. main() returns an int value which is reported as the program's termination status. You can also invoke the exit() function to report this status. A normal return from main() without a value (such as occurs when the closing } of the main() function body is "executed") is erroneous, whether or not the compiler happens to complain about it. The start-up code that invoked main() in the first place is expecting a return value.