Re: Possible reasons for a C++ exception being thrown for line three?
Peter Olcott schrieb:
"Joseph M. Newcomer" <newcomer@flounder.com> wrote in
message news:leh233hvdoor7qsumj6alb4bbedn7ugf36@4ax.com...
It would be alot easier to diagnose if we had some idea
how long the strings were, or what
kind of exception was thrown, and by whom, and what line
of code threw the error. You can
enable the debugger to stop on C++ exceptions at the throw
(go to Debug>Exceptions)
joe
I tried this and waited an hour and a half only to find that
the debug code works correctly. When it is not in the
debugger, then it throws the exception.
*****************
Is the debug version failing when not run in the debugger, or does the release
version fail? If the release version fails, run that in the debugger.
It throws the
exception on this line.
if (MatchedSTRING != String2MATCH) {
I store a global LineNumber and display it when the
exception is caught.
I have another thread that asks how to get more specific
exception info. I have been using catch(...) because it
always works.
*********************
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.
std::string MatchedSTRING;
char String2MATCH[1000];
*******
Do you guarantee in your code that String2MATCH always contains a valid
NUL-terminated string with less than 1000 characters?
Norbert