prev up next   top/contents search

comp.lang.c FAQ list · Question 11.14a

Q: I believe that declaring void main() can't fail, since I'm calling exit instead of returning, and anyway my operating system ignores a program's exit/return status.

A: It doesn't matter whether main returns or not, or whether anyone looks at the status; the problem is that when main is misdeclared, its caller (the runtime startup code) may not even be able to call it correctly (due to the potential clash of calling conventions; see question 11.12b).

Your operating system may ignore the exit status, and void main() may work for you, but it is not portable and not correct.

Additional links: further reading

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

Hosted by Eskimo North