I see catch (…) does not catch all the exceptions and an annoying pop is thrown on end user.
size_t pos;
char *ptrDir="c:\\test";
std::string strDir =
strDir.erase(strlen(ptrDir) - 1);
pos = strDir.find("Test");
try
{
std::string strPat = strDir.substr(pos);
}
catch(...)
{
std::cout<<"I am hiding Exception";
}
I am using Visual Studio 2005, Windows XP.
Note: Code is intentional to generate exceptions. It’s a test code
Your code will likely generate access violations, which in VC++ are not going to be standard exceptions, they are in the realm of Structured Exceptions, which you can also catch but will need to use a different mechanism:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms680657(v=vs.85).aspx
Structured Exception Handling