Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-43010

remove DEV and MONGO_DEV `if`-macros

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.3.1
    • Affects Version/s: None
    • Component/s: Internal Code
    • Labels:
      None
    • Fully Compatible
    • Dev Tools 2019-08-26

      These macros read like statement attributes but are really flow control.

      They have the potential to "falsely" bind to following else statements, and clang-format can't see through it.

      The hidden if condition can't combine with other conditions using && and ||, so it ends up in some cases making code a little worse.

      `DEV` is too broad a namespace. Indeed we touch third-party source using it as an enum value.

      It could be confused with "DEVice".

      It isn't clear that DEVelopment build maps 1:1 to a "debug" build. Meaning is unclear.

      As an alternative, we can inline it where it appears, writing `if (kDebugBuild)` and we will have more conventional code. The sugar of the DEV macro isn't valuable enough to justify its risks.

      `mongo::kDebugBuild` is a conventional constexpr bool variable.

            Assignee:
            billy.donahue@mongodb.com Billy Donahue
            Reporter:
            billy.donahue@mongodb.com Billy Donahue
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: