Turbo C atexit function.

Doug Gwyn gwyn at smoke.BRL.MIL
Thu Jun 22 06:31:33 AEST 1989


In article <22420 at iuvax.cs.indiana.edu> bobmon at 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.



More information about the Comp.lang.c mailing list