I agree with the 1st 2 points, however there are 2 things that I think can make the last point a decision:
- If you’re using libraries, the NDEBUG is pretty standard, and you may not have another way (short of modifying the library itself) to enable/disable the debug features. A good example of this is the Eigen library.
- Asserts, for us, are treated as runtime code checks. I.e. we don’t use them for errors that should be able to occur at runtime. The key place where they become valuable is being able to check runtime code correctness in performance critical sections. In the relaxed constraints of the debug domain, we can typically allow for slower code, and thus more extensive checking. The obvious caveat here, that you have already alluded to is that if you have any timing related bugs in the code, the different execution time can make debugging more tricky.
So if you do have a need to have multiple builds, it is really helpful to make sure that you run testing on both.