Skip to content

assert() is always ignored #1455

Discussion options

You must be logged in to vote

But the project is build so that NDEBUG is always defined

This is by design.
https://stackoverflow.com/questions/11778121/why-assert-macro-makes-use-only-for-debug-build

I've tried running cmake with cmake build-type=Debug ...,

The correct way to build in Debug mode is cmake -DCMAKE_BUILD_TYPE=Debug.
Your command line reports a error.

assert() is always ignored (even in unit-tests)

I personally do not encourage using assert macro. For the most of applications, if a proper set of unit tests is defined,, it can be avoided.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by pavelkryukov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1454 on February 21, 2021 16:22.