When an assert() call fails, what is the exit code used, and where is it documented?
When an assert() call fails, what is the exit code used, and where is
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The C99 (unchanged in C11) standard states that
assertcallsabortand theabortstuff states this about the return code:It’s documented in section 7.2.1.1 (assert) and 7.20.4.1 (abort) of the C99 standard here.
Many UNIX systems will return 128 plus the signal number (
SIGABRTis signal number 6) so you may get 134. Whatever you get, it should be documented by the C implementation.For example, see here for
gcc. Although it’s quite silent on what gets returned to the calling environment. From the specific sections here:And here:
So is the
glibcdoco here on program termination (specifically the exit status bit). It mentions conventions but no firm rules.