You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2018/10/19 18:19:10 UTC

[GitHub] ccollins476ad commented on issue #1471: sys/sys: Add `DEBUG_PANIC()` macro

ccollins476ad commented on issue #1471: sys/sys: Add `DEBUG_PANIC()` macro
URL: https://github.com/apache/mynewt-core/pull/1471#issuecomment-431453131
 
 
   The dev list email probably goes into more detail than anyone is interested in :).  The short answer is:
   
   * `DEBUG_ASSERT()` does not evaluate an expression to determine success / failure; it assumes failure.  Since these failures are expected, I think it is likely that the application will always want to execute some code in the failure case, regardless of whether the macro is configured to trigger a crash.  For example: logging a message to the console when the failure is detected.
   
   * `DEBUG_ASSERT()` is intended to be disabled in production builds, so it should also be followed by code that recovers from the failure.  `assert()` is meant to ensure that that failure that "should never happen" indeed never happen, so there is no need for recovery code.  In addition, even though `assert()` can be disabled via `NDEBUG`, I am of the opinion that it should never be disabled, as it helps eliminate a lot of possibilities when debugging faults in the field.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services