Re: Error diagnosis
SteveB wrote:
We have an app that was written a few years ago in which the
developers wrote an entire exception handling system.
I have a problem with the following line if code:
OutStream << L" (+ " << std::dec <<
static_cast<DWORD>(Disp64) << L" bytes), ";
This is throwing the following exception:
Run-Time Check Failure #2 - Stack around the variable 'stIHM' was
corrupted.
I was wondering if anyone could interpret what the line of code is
actually doing and what the error means - a Google search has proved
fruitless
The line of code outputs (as the name 'OutStream' suggests) three
fields to the stream. First, it's the wide-char literal (a C string
that consists of 'wchar_t' elements) with contents <space><leftparen>
<plus><space>, then it turns on decimal output, takes 'Disp64' value
and converts it to a DWORD, and lastly outputs another wide character
literal. I imagine if 'Disp64' value is one hundred, the output would
look like " (+ 100 bytes), "
If the stack is corrupted, and the system reports it during executing
that statement, it usually means some bad action took place before
and simply shows up here. Just like memory overruns (and stack
corruption is usually due to a memory overrun) those are difficult
to diagnose -- the trouble becomes visible sometimes way past the
actual problem point.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask