How can I catch runtime error in C++
- by Yan Cheng CHEOK
By referring to http://stackoverflow.com/questions/315948/c-catching-all-exceptions
try {
int i = 0;
int j = 0/i; /* Division by 0 */
int *k = 0;
std::cout << *k << std::endl; /* De-reference invalid memory location. */
}
catch (...) {
std::cout << "Opps!" << std::endl;
}
The above run-time error are unable to be detected. Or, am I having wrong expectation on C++ exception handling feature?