C++ Language/ErrorHandling/Assertions

From Wikibooks, open books for an open world
Jump to navigation Jump to search

The assert(condition); statement is conditionally-compiled. When building a debug build-configuration, define the _DEBUG preprocessor symbol so that assert() will evaluate its condition (aborting the software execution if that condition evaluates to false). When building a release build-configuration, instead define the NDEBUG preprocessor symbol so that assert() efficiently generates no machine language code.

Additional information about assertions