Search code examples
boostboost-preprocessor

BOOST Hardening Guide (Preprocessor Macros)


I'm having a hard time determining what preprocessor macros I should use with Boost for (1) debug instrumentation (such as checked iterators) and (2) security related items.

All I can seem to find is Preprocessor Metaprogramming (linked from www.boost.org/libs/preprocessor/).

UPDATE (02-18-2013): I found Boost Macro Reference, but it lacks anything related to debugging or security.

Does anyone know of a list of available preprocessor macros for debugging and security or a hardening guide?


Solution

  • There's not really any equivalents I'm aware of in any of the boost libraries. A few of them respect NDEBUG and make optimisations based on that (and there are also some asserts NDEBUG would disable), so setting NDEBUG for release but not debug would seem to be expected (whether leaving NDEBUG undefined for release counts as "hardening" I don't know). But certainly none of the libs have options beyond that which give them any extra armour-plating or debuggability.

    How the boost libraries should interact with Microsoft's _HAS_ITERATOR_DEBUGGING and particularly _SECURE_SCL is a recurring debate see e.g here, here and here (for the "header-only" libraries it doesn't make much difference; it's more of a problem making sure provided DLLs are compatible with what integrators expect, and there's no universal agreement on whether MS defaults for these options should be used or not as many people are suspicious of the performance overheads).