Details
-
Improvement
-
Resolution: Fixed
-
Major - P3
-
None
-
None
-
Fully Compatible
-
Dev Tools 2019-08-26
Description
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.