How the question is explained: I would like to add debugging code that runs only when the program is connected to the debugger. I would suggest that this variable flageither pre-processorwill be different for each compiler ...
flag
pre-processor
In my case, I am using Microsoft Visual Studio 2010 with C ++.
I also use Eclipse on another computer at home running Ubuntu 10.4 and again in C ++.
This question may mean 1 out of 2 things:
, , (, _ DEBUG Win32 CRT).
.
, , - , false, :
false
bool gDebug = false;
, gDebug true . , , , true:
gDebug
true
if (gDebug) { // Debugger is attached, so run this code // ... }
DWORD, 0, 1 .
DWORD
0
1
, 1.. , , , .
1.
, - debug/release, debug ( , MSV++ CRT - ) _DEBUG, , /.
_DEBUG
, IsDebuggerPresent API, , .
, 100% , . , / , (, , OutputDeubgString ..). , , , .
, , , "" . , , (, Windows), .
in_debugger - false . true. true.
in_debugger
. :http://sourceware.org/gdb/onlinedocs/gdb/Calling.html
,Marcin
Source: https://habr.com/ru/post/1775315/More articles:For learning Python, does it matter if I use 32 or 64 bit Python? - python.NET Graphics - creating an ellipse with a transparent background - c #Why does the compiler allow you to "write" a const variable here? - c ++ASP.NET MVC - Show 404 general views without a controller - asp.net-mvcPython module import error "ImportError: no module named mrjob.job" - pythonhref для учетной записи "Jabber/Google Chat" - htmlDoes SLIME have a hotkey for commenting a block of Lisp code in slime-mode? - commentsJust can't get Entity Framework to pull what I want - c #Development Methodology for Immature Teams - agilereduce equivalent in jQuery? - jqueryAll Articles