warning about exit() function
The exit function, declared in the standard include file STDLIB.H, terminates a C++ program.
In MSDN:
Issuing a return statement from the main function is equivalent to calling the exit function with the return value as its argument.
That is NOT true.
When you call the exit or _exit functions, the destructors for any temporary or automatic objects that exist at the time of the call are not called.
While a return statement will call destructors of objects.
In MSDN:
Issuing a return statement from the main function is equivalent to calling the exit function with the return value as its argument.
That is NOT true.
When you call the exit or _exit functions, the destructors for any temporary or automatic objects that exist at the time of the call are not called.
While a return statement will call destructors of objects.
Labels: C++
0 Comments:
Post a Comment
<< Home