In C++ the use of exit() is considered poor practice. Terminating the program using exit() doesn't invoke destructors for local objects. Better is to terminate with return via main() or throw an exception, the latter providing an opportunity for dealing with the condition that caused it.Originally posted by deadpoet
There are 1000 diferent was to accomplish anything in C/C++, if one prefers exit over return, the fact still remains that you gave an int back to the operating system. I feel that return should be reserved for functions, methods, and such. When you exit a program you should indicate as such thus, my use of exit. I am exiting the program.
However, if there is a solid reason as to why I should return instead of exit when I am leaving a program then I am all ears.