Click here to Skip to main content
15,895,839 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Bug in Visual Studio 2005 compiler? Pin
Richard MacCutchan17-Jan-14 8:07
mveRichard MacCutchan17-Jan-14 8:07 
GeneralRe: Bug in Visual Studio 2005 compiler? Pin
Stefan_Lang19-Jan-14 23:29
Stefan_Lang19-Jan-14 23:29 
GeneralRe: Bug in Visual Studio 2005 compiler? Pin
Stefan_Lang19-Jan-14 23:44
Stefan_Lang19-Jan-14 23:44 
QuestionRe: Bug in Visual Studio 2005 compiler? Pin
Richard MacCutchan20-Jan-14 0:21
mveRichard MacCutchan20-Jan-14 0:21 
AnswerRe: Bug in Visual Studio 2005 compiler? Pin
Stefan_Lang20-Jan-14 0:24
Stefan_Lang20-Jan-14 0:24 
GeneralRe: Bug in Visual Studio 2005 compiler? Pin
a_matseevsky20-Jan-14 0:52
a_matseevsky20-Jan-14 0:52 
GeneralRe: Bug in Visual Studio 2005 compiler? Pin
Stefan_Lang20-Jan-14 1:21
Stefan_Lang20-Jan-14 1:21 
GeneralRe: Bug in Visual Studio 2005 compiler? Pin
a_matseevsky20-Jan-14 2:06
a_matseevsky20-Jan-14 2:06 
Stefan_Lang wrote:

In the meantime I've spotted the code that you posted in a different branch of this thread. It isn't the original code though, and doesn't provide sufficient insight to answer any of the questions I posted. You state that variant A doesn't work, but it doesn't use the max() function, so we have to assume that the assembler code generated from that doesn't match the bits you later found to be incorrect (if they are indeed that - we still do not know)

What do you mean, writing "it isn't the original code?" That I copied it from somewhere or what? I never stated, that variant A does not work. It is your idea. I asked, which works and which not (and why). You was not able to answer this question and preferred to ignore it.

In the code you posted you use some variables that are only referenced over a couple of lines. They may not in fact be stored in the stack at all! As a result, the debugger will not show their contents in the optimized release code. Similarly, if you define a struct with data that is never referenced, the compiler may decide to optimize away the unneeded bits, reducing the size of the struct. You haven't posted the definition of the struct, nor where it's accessed, so it's impossible to tell if that is the case.

All fields of the RECT structute was later used. If compiler decided that they are no more in use, it is just its bug. RECT structure is so well-known, that i did not placed its definition here. It contents 4 fields of type long- top, left, right and bottom. Just 16 bytes. I ran release version under debugger and I saw all assembler commands and order of their execution. Therefore, I know which variables was not stored in a stack and which temporary variables (which I did not declared!) was stored and where.


I could go on and easily bring up half a dozen or more other optimization techniques that you appear to be unaware of, and that will confound your ability to read useful information from the debugger alone within optimized code. But it's pointless.

Pointless is to repeat things like "there are more things on the Earth, on the heaven, than any dreamt of in our philosophy". What makes you think that I do not know about optimization? Stop walking around and answer to one simple question: why local variable, visible and accessible, was overwritten? You cannot name at least one more or less credible reason. If it is not visible, I couldn't get access to it and debugger wouldn't show it. Just this situation happens with variables, which are used in one-two lines of code. Debugger doesn't show them at all (worry not, I know such things).
GeneralRe: Bug in Visual Studio 2005 compiler? Pin
Stefan_Lang20-Jan-14 3:46
Stefan_Lang20-Jan-14 3:46 
GeneralRe: Bug in Visual Studio 2005 compiler? Pin
a_matseevsky20-Jan-14 12:30
a_matseevsky20-Jan-14 12:30 
GeneralRe: Bug in Visual Studio 2005 compiler? Pin
a_matseevsky20-Jan-14 1:27
a_matseevsky20-Jan-14 1:27 
GeneralRe: Bug in Visual Studio 2005 compiler? Pin
Stefan_Lang20-Jan-14 1:59
Stefan_Lang20-Jan-14 1:59 
GeneralRe: Bug in Visual Studio 2005 compiler? Pin
a_matseevsky20-Jan-14 2:42
a_matseevsky20-Jan-14 2:42 
GeneralRe: Bug in Visual Studio 2005 compiler? Pin
Stefan_Lang20-Jan-14 3:33
Stefan_Lang20-Jan-14 3:33 
GeneralRe: Bug in Visual Studio 2005 compiler? Pin
a_matseevsky20-Jan-14 12:46
a_matseevsky20-Jan-14 12:46 
AnswerRe: Bug in Visual Studio 2005 compiler? Pin
jschell17-Jan-14 13:16
jschell17-Jan-14 13:16 
GeneralRe: Bug in Visual Studio 2005 compiler? Pin
a_matseevsky17-Jan-14 14:33
a_matseevsky17-Jan-14 14:33 
GeneralRe: Bug in Visual Studio 2005 compiler? Pin
Richard MacCutchan17-Jan-14 22:24
mveRichard MacCutchan17-Jan-14 22:24 
GeneralRe: Bug in Visual Studio 2005 compiler? Pin
a_matseevsky18-Jan-14 0:46
a_matseevsky18-Jan-14 0:46 
GeneralRe: Bug in Visual Studio 2005 compiler? Pin
Richard MacCutchan18-Jan-14 1:13
mveRichard MacCutchan18-Jan-14 1:13 
GeneralRe: Bug in Visual Studio 2005 compiler? Pin
a_matseevsky18-Jan-14 10:01
a_matseevsky18-Jan-14 10:01 
GeneralRe: Bug in Visual Studio 2005 compiler? Pin
Richard MacCutchan18-Jan-14 22:13
mveRichard MacCutchan18-Jan-14 22:13 
GeneralRe: Bug in Visual Studio 2005 compiler? Pin
a_matseevsky19-Jan-14 1:07
a_matseevsky19-Jan-14 1:07 
GeneralRe: Bug in Visual Studio 2005 compiler? Pin
Richard MacCutchan19-Jan-14 1:08
mveRichard MacCutchan19-Jan-14 1:08 
GeneralRe: Bug in Visual Studio 2005 compiler? Pin
a_matseevsky19-Jan-14 10:54
a_matseevsky19-Jan-14 10:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.