Search code examples
c++visual-studiodebuggingrelease-mode

Visual C++ - Why bother with Debug Mode?


So I have just followed the advice in enabling debug symbols for Release mode and after enabling debug symbols, disabling optimization and finding that break-points do work if symbols are complied with a release mode, I find myself wondering...

  1. Isn't the purpose of Debug mode to help you to find bugs?
  2. Why bother with Debug mode if it let bugs slip past you?

Any advice?


Solution

  • Debug mode doesn't "let bugs slip past you". It inserts checks to catch a large number of bugs, but the presence of these checks may also hide certain other bugs. All the error-checking code catches a lot of errors, but it also acts as padding, and may hide subtle bounds errors.

    So that in itself should be plenty of reason to run both. MSVC performs a lot of additional error checking in Debug mode.

    In addition, many debug tools, such as assert rely on NDEBUG not being defined, which is the case in debug builds, but not, by default, in release builds.