Skip to main content
gamedev.net
🔒 Locked

DEBUG and _DEBUG

Started by Quat Jul 29, 2007 at 11:57 AM 1 replies 700+ views
Original Post
Quat
Quat
Does anyone know why there are two debug symbols defined? Why does VC++ use DEBUG and _DEBUG? Why not just have one?
-----Quat
Antheus
Antheus
Symbol prefixed with _ are defined to be for internal compiler use. As such, end-user should be unconcerned with their role.

_DEBUG is Microsoft implementation specific and is tied to Microsoft's standard library.

The documentation states when it's defined.

As a general rule, if you're going for portability, handle symbols prefixed with one or more underscores as compiler-specific, and use proper ifdef guards.
SiCrane
SiCrane
If you want to know why, it's because some compilers defined DEBUG and some defined _DEBUG and so in order to be able be compatible with the most code MSVC defines both.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.