I read in Google C ++ coding standards that Google does not use an exception. If an exception is not used, how do you free memory when errors occur in your program?
For example, f () calls g (), and if there is an error in g (), I have to free all the memory allocated in g (), and then throw an exception from f (). When f () catches the exception, f () will free all memory allocated in f () and exit the program.
If the exception is not used, and if there is an error in g (), can I force exit exit(0) to end and will the C ++ program be smart enough to free all the allocated memory? I assume that C ++ supports the stack and heap, and as soon as the program exits, C ++ will automatically free the stack and heap?
source share