I believe that declaring void main) cant fail ...

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.

✍: Guest

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
Your operating system may ignore the exit status, and void main() may work for you, but it is not portable and not correct.

2015-12-18, 1215👍, 0💬