anchao commented on PR #17300:
URL: https://github.com/apache/nuttx/pull/17300#issuecomment-3516966428
> If rtcb is allowed to be NULL, then `if (rtcb == NULL) { /* handle the
NULL case */ ... }` check should be written before the DEBUGASSERT, and the
DEBUGASSERT should check only the lockcount.
>
> If rtcb is not allowed to be NULL, then I guess both checks can be written
in DEBUGASSERT.
>
> There may be a disadvantage to combining both checks in one DEBUGASSERT:
if assertion fails, you won't know whether it's because of rtcb == NULL, or
because of invalid lockcount. It might be better to write each condition in its
own DEBUGASSERT.
rtcb is not allowed to be NULL after idle tcb initialization;
The issue with this commit is that it removes the rtcb check from the if
statement. When DEBUGASSERT is disabled, it cannot catch the exception where
rtcb is NULL.
If everyone agrees that rtcb can never be NULL, then adding an assertion for
rtcb in DEBUGASSERT would be redundant and unnecessary
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]