Re: Possible reasons for a C++ exception being thrown for line three?
Peter Olcott schrieb:
"Norbert Unterberg" <nunterberg@newsgroups.nospam> wrote in
It throws the exception on this line.
if (MatchedSTRING != String2MATCH) {
Are you using the same std::string in more than one
thread? strings are not thread safe.
Does the catch(....) catch the exception? Do you have
installed a structured exception handler? THis might even
catch (and therefor hide) an access violation or other
WIN32 exceptions.
I tried your other advice and it was the catch(...) that
caught it. It looks like its an access violation, probably
for a std::string. I am only using a single thread. What
kinds of things besides using std::string::operator[] with a
value larger than the last element could cause an access
violation to a std::string in a single thread?
You told us that the debug version does not show the problem.
So my next try would be:
* Enable debug information for the release version (VS2005 does that already)
* Set VS to break on any exception (see Debug-->Exceptions)
* Switch to the Release version
* Run the release version under the debugger.
If your application throws exceptions in some othe places, you could remove the
problematic catch(...) from your code and tell VS to break on unhandled exceptions.
Another note: Access violations are usually NOT caught by C++ exception
handling. If they are caught by your catch(...) handler, then you have installed
a structured exception handler somewhere in your code that throws a C++
exception. Search your project for a call of _set_se_translator(). If you find
it then disable it, and the debugger will break on the access violation. Even if
your app is not running under the debugger, the Windows error dialog will offer
you to debug the problem with VS2005 if the access violation
Norbert