11.07.2015 Views

CrossWorks for ARM User Guide

CrossWorks for ARM User Guide

CrossWorks for ARM User Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

- DiagnosticsThe header file defines the assert macro under control of the NDEBUGmacro, which the library does not define.Macrosassert (page 242)Assert that a condition is trueassertSynopsisDescription#include void assert(expression);assert allows you to place assertions and diagnostic tests into programs.If NDEBUG is defined as a macro name at the point in the source file where is included, the assert macro is defined as:#define assert(ignore) ((void)0)If NDEBUG is not defined as a macro name at the point in the source file where is included, the assert macro expands to a void expression that calls__assert. When such an assert is executed and expression is false, assert calls the__assert function with in<strong>for</strong>mation about the particular call that failed: the text of theargument, the name of the source file, and the source line number. These are thestringized expression and the values of the preprocessing macros __FILE__ and__LINE__.The prototype <strong>for</strong> __assert is:extern void __assert(const char *, const char *, int);There is no default implementation of __assert. Keeping __assert out of the librarymeans that you can can customize its behaviour without rebuilding the library.Important notesPortabilityThe assert macro is redefined according to the current state of NDEBUG each time that is included.assert con<strong>for</strong>ms to ISO/IEC 9899:1990 (C90).242 Chapter 28 Standard C Library Reference

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!