Ok, i am going to keep this simple and not include all the code (yet) if I don't need to. My inner senses tell me that there is probably a simple answer to this and I have overlooked it as usual. More inexperienced might say the compiler is the problem but I have never known that to be the case 99.999% of the time it has always been an error on my part in some way so... heres the question. I have a program, this program is supposed to output two strings, nothing fancy
TCHAR* firststring = _T("FirstValue");
TCHAR* secondstring = _T("SecondValue");
_tprintf(_T("%s\n"),firststring);
_tprintf(_T("%s\n"),secondstring);
which outputs..
firststring
in the particular section of my code, this does not work (it works elsewhere) UNLESS i am step-over-debugging... then it is fine...
firststring
secondstring
I have even tried combining the operation into one by doing this:
_tprintf(_T("%s\n[%s]\n"),firststring,secondstring);
My result is, the first string, and the braces are there to try to point out that the string is trying to be print out and if it is empty, etc. I get this output:
firststring
]
and that's it.. again, UNLESS step-over debugging, then its all fine and dandy:
firststring
[secondstring]
has anyone ever heard of a problem like this? The last time I encountered weird problems like this was back in the ASM days with segment alignment but I doubt that is the case here, although I am not sure on _tprintf's inner workings... I'm going to try this again, if nobody knows, i'll assume its because of a error caused by the code earlier. The main question is, does this happen for any simple reason or does this just point to problems earlier in the program, that's all. Thanks for your reply.
PS: I realize that I didn't supply sufficient code to completely answer the problem, but the question is whether or not there is a known simple cause to this kind of behavior in the debugger (run vs. step-over). The breakpoint is set at the function level, I'm using Visual Studio 2008. Compiler Versions follow:
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.21022.08 80x86
Microsoft (R) Macro Assembler Version 9.00.21022.08
Microsoft (R) Incremental Linker Version 9.00.21022.08
Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
Microsoft Browse Information Maintenance Utility Version 9.00.21022
Microsoft (R) Manifest Tool version 5.2.3790.2075