Click here to Skip to main content
15,894,343 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
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 
Stefan_Lang wrote:

Therefore I decided to derive it based on you statements elsewhere: Variant B contains code that works by your own statement elsewhere. neither contains the max() funtion you refer to in your original question. So B is the working and A the not working - albeit not the original - version. Q. E. D.

Again- I never claimed, which variant works and which does not. It was my question. And what "not the original version" means? I made my own investigation since the time, when I asked my first question. I changed code many times. I found, that no min nor max are not the source of the problem. There is no need in demonstrating of the rest of original code- it is the same for A and B. The difference is only here, in these few lines. And my question was- how could it be- both variants are correct. So you cannot answer to my question. Should I send you the answer or you will think for a while?

As for what is pointless or not: advice is only pointless if it isn't heeded. You believe that the debugger shows you every information correctly? It doesn't. It can't. It's physically impossible.

Why? Which part is hidden? Pipelines? Debugger demonstrates me all what I need to understand the core of situation. You must work really hard, if you want to cheat (or to trick- whichever word do you prefer) debugger. It happens mostly with self-modified code.


I've dealt with optimizers 30 years ago: back then it wasn't to hard to anticipate what it would do, and in C you could often emulate pretty much the same without having to invoke the optimizer at all. meaning well optimized C code ran almost as well in debug mode as it did in release.

I've dealt with optimizers 20 years ago, and it got more tricky. Still, well optimized C-code often turned out to be near optimal.

I've dealt with optimizers 10 years ago, and the experience was very different: for one, the same optimizations in C code sometimes led to slower code, because it prevented the optimizer from performing extremely sophisticated optimizations that you'd never have thought of. Plus the size of the codebase made it impossible to optimize all of your code in that way anyway.

At that point I stopped trying to optimize my C/C++ code by hand.

More than strange idea. Hi-level optimization cannot be performed by compiler. Low-level usually yes, but not always.

Nowadays, when I check release code that doesn't do the same as debug code, I often find that half the variables aren't on stack, and some others get overwritten at unexpected moments. At least when I look at them through the debugger. It's the optimizer at work! What I usually do is pinpoint the location where everything goes south, then insert some print statements to ensure everything is as I expect it to be - and in 9 cases out of 10, something will not be as I expect it to be! And the debugger won't be able to show it!

I should ask you, do you really know, how one can get debugger demonstrate all of what he needs? Do you use register's window? Co-processor's one? Debugger may demonstrate you memory at any address what you need. And when I run release under debugger, it demonstrates me result of disassembling of binary executable file- just what it is executing, BUT NOT MY SOURCE CODE! This is why I see just what is executed. And I can compare it with the listing, which contains source C++ and assembler. I can create release with debugger info and create separated file with database. Debugger (even part of Visual Studio) is very powerful one and been properly used, can give you all what you need and more that that. Sorry, but I printed variables too- many years ago. it was only because I did know how to work with debugger. Later I found that debugger offers me info which I needed in the more convenient way.


That's why I keep telling you not to trust the debugger - and looking at the assembler code doesn't change that you're using the debugger.

You may trust debugger, if you know, how to use it.
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 
GeneralRe: Bug in Visual Studio 2005 compiler? Pin
pkfox19-Jan-14 20:20
professionalpkfox19-Jan-14 20:20 
GeneralRe: Bug in Visual Studio 2005 compiler? Pin
Richard MacCutchan19-Jan-14 22:21
mveRichard MacCutchan19-Jan-14 22:21 

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.