1

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?

2
  • The answer is likely specific to a boost library, which ones are you targeting?
    – Sam Miller
    Feb 18, 2013 at 0:50
  • Thanks @Sam. As for which library - its all of them. Boost supposedly has coding requirements, quality checks, etc. So I expect they have something thing similar to GCC's _GLIBCXX_DEBUG or Microsoft's _HAS_ITERATOR_DEBUGGING. Or does Boost pickup on those macros (and honor others such as DEBUG and _DEBUG)?
    – jww
    Feb 18, 2013 at 9:27

1 Answer 1

1

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).

3
  • Thanks @timday. I'll make a note at C-Based Toolchain Hardening. Jeff
    – jww
    Feb 18, 2013 at 12:41
  • Is your name "Tim Day"? I would like to cite you on the OWASP article.
    – jww
    Feb 18, 2013 at 12:45
  • Yes, that's fine. Now I've seen the context, adding a few more links above.
    – timday
    Feb 18, 2013 at 16:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.