PR 5399 adds an Kconfig option for NDEBUG. The salient discussion begins at
[2] there are mixed positions and reasoning. xiaoxiang781216 asked me to
raise a discussion on this.



The reasoning for the Default state of to be NDEBUG (n) hence undefined so
that assert() enabled is the following:



1)  It follows the standard understanding of NDEBUG



                  The standard for standard library from [3]



         The definition of the macro assert depends on another macro,
NDEBUG, *which is not defined* by the standard library.





      2) We have DEBUGASSERT for use in the OS. I believe this was an
intentional separation on Greg’s part. We have asked for is input.



In a NuttX "Release" build DEGUASSERT is off (all debug is off to show off
the build size).

I should still be able to build the app code with assert() and not have to
use a Kconfig to enable it.

How would you prefer it to be defined?



   1. Defaulted ON – assert() is a No OP
   2. Defaulted OFF assert() is enabled.
   3. Left to a command line setting from build system



David



[1] https://github.com/apache/incubator-nuttx/pull/5399



[2]
https://github.com/apache/incubator-nuttx/pull/5399#issuecomment-1029387606

[3]
https://en.cppreference.com/w/c/error/assert#:~:text=If%20NDEBUG%20is%20defined%20as,the%20source%20code%20where%20%3Cassert.&text=If%20NDEBUG%20is%20not%20defined,output%20and%20calls%20abort()
.

Reply via email to