prev up next   top/contents search

comp.lang.c FAQ list · Question 11.16

Q: Is exit(status) truly equivalent to returning the same status from main?


A: Yes and no. The Standard says that a return from the initial call to main is equivalent to calling exit. However, a return from main cannot be expected to work if data local to main might be needed during cleanup; see also question 16.4. A few very old, nonconforming systems may once have had problems with one or the other form. (Finally, the two forms are obviously not equivalent in a recursive call to main.)

References: K&R2 Sec. 7.6 pp. 163-4
ISO Sec. 5.1.2.2.3


prev up next   contents search
about this FAQ list   about eskimo   search   feedback   copyright

Hosted by Eskimo North