Isn't what you describe basically the same as Linux behavior.  assert() is like exit() and should cause the task to end, should it not?

Per OpenGroup:

https://pubs.opengroup.org/onlinepubs/009695399/functions/assert.html: When it is executed, if /expression/ (which shall have a *scalar* type) is false (that is, compares equal to 0), /assert/() shall write information about the particular call that failed on /stderr/ and shall call /abort/() <https://pubs.opengroup.org/onlinepubs/009695399/functions/abort.html>.

https://pubs.opengroup.org/onlinepubs/009695399/functions/abort.html: he /abort/() function shall cause abnormal process termination to occur, unless the signal SIGABRT is being caught and the signal handler does not return.

The only non-compliance that I see is that NuttX does not send the SIGABRT signal.

On 3/27/2021 1:30 PM, Matias N. wrote:
I was using assert in an app (testing on sim) and realized the sim exited upon 
hitting the assert. From the code I see it calls into up_assert() (which would 
also be a violation of OS/Userspace separation AFAIK).
What about writing a similar simple function that only sends the message to 
syslog and does exit() so the app exists?
This would only be for lowercase assert() of course.

Best,
Matias


Reply via email to