4.4.2. Exiting from the program

The program can exit normally at the end of main() or it can exit prematurely because of an error. See also:

Exiting from an assert

The exit sequence from an assert is:

  1. assert() prints a message on stderr.

  2. assert() calls abort().

  3. abort() calls __rt_raise().

  4. If __rt_raise() returns, abort() tries to finalize the library.

If you are creating an application that does not use the library, assert() works if you retarget abort() and the stdio functions.

One solution for retargeting is to retarget the assert() function itself. The function prototype is:

void __assert(const char *expr, const char *file, int line);

where

  • expr points to the string representation of the expression that was not TRUE

  • file and line identify the source location of the assertion.

Copyright © 1999-2001 ARM Limited. All rights reserved.ARM DUI 0067D
Non-Confidential