I really like how gdb allows me to script a routine for breakpoints using the command command. Often times, I add print statements to just print a message, and I like how all of this works without modifying the source file.
I had to use Visual Studio and I found out that the way to insert debug print statements is using OutputDebugString. But, I don't like how I need to modify my source code in order to debug. Is there a way to print debug messages in VS like in gdb, i.e. without modifying source.
Also, how does the VC compiler process the OutputDebugString call? Does it actually compile that line in the program's assembly? Do I need to compile my code if the only change I made is to add a call to OutputDebugString?
#ifdef _DEBUG OutputDebugString() #endifso that when you're compiling on release mode none of this functions will actually compile and will be left out of the program. And yes, the function generates assembly(generated machine) code. The lasts question I don't fully understand, I think you need to compile your code if you make ANY changes to it...