Do Not Ship Your Program Built with TBB_DO_ASSERT

TBB_DO_ASSERT not only adds assertion checking, it also turns off some inlining and enables extra hidden fields in some data structures. Therefore, it slows down performance. Furthermore, code compiled with TBB_DO_ASSERT is typically linked against the debug version of the library, which has some significantly slow assertion checks.

TBB_DO_ASSERT writes out failures to stderr; there is no way to request it to throw exceptions. The errors it detects are so egregious that they should be eliminated during debugging and are not the sort we expect anyone to plan to handle in production code.

On Windows, the debug version is linked against Microsoft’s debug library, another reason it is unsuitable for production use. It is possible to use TBB_DO_ASSERT=1 and link against the release version of the Threading Building Blocks library, which gets you a few assertion checks. Still, we recommend setting TBB_DO_ASSERT=1 for development and debugging but having TBB_DO_ASSERT=0 for production code.

Get Intel Threading Building Blocks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.