Assert.h


Assert.h

assert.h is a header file in the standard library of the C programming language that defines the C preprocessor macro assert(). The macro implements an assertion, which can be used to verify assumptions made by the program.

The assert() macro inserts diagnostics into programs. When executed, if the expression is false (that is, compares equal to 0), assert() writes information about the call that failed on stderr and then calls abort(). The information it writes to stderr includes:
* the text of expression that evaluated to 0
* the source filename (the predefined macro __FILE__)
* the source line number (the predefined macro __LINE__)

Programmers can eliminate the testing code produced by the macro assert without removing the macro references from the program by defining the macro NDEBUG in the program before including . If NDEBUG is defined as a macro name before the inclusion of this header, the assert() macro is defined simply as:

#define assert(ignore)((void) 0)

and therefore has no effect on the program.

The assert() macro is implemented as a macro, not as a function. If the macro definition is suppressed in order to access an actual function, the behaviour is undefined.


Wikimedia Foundation. 2010.

Look at other dictionaries:

  • Assert.h — Стандартная библиотека языка программирования С assert.h complex.h ctype.h errno.h fenv.h float.h inttypes.h iso646.h limits.h locale.h math.h setjmp.h signal.h stdarg.h stdbool.h stddef.h stdint.h stdio.h …   Википедия

  • Assert — As*sert , v. t. [imp. & p. p. {Asserted}; p. pr. & vb. n. {Asserting}.] [L. assertus, p. p. of asserere to join or fasten to one s self, claim, maintain; ad + serere to join or bind together. See {Series}.] 1. To affirm; to declare with assurance …   The Collaborative International Dictionary of English

  • Assert.h — Saltar a navegación, búsqueda assert.h es un archivo de cabecera de la biblioteca estándar del Lenguaje de programación C, en el que se define la macro de depuración assert (aserción, en inglés), que implemeta una aserción (test), usada para… …   Wikipedia Español

  • assert — 1 Assert, declare, profess, affirm, aver, protest, avouch, avow, predicate, warrant agree in meaning to state positively usually either in anticipation of denial or objection or in the face of it. Assert implies absence of proof: it usually… …   New Dictionary of Synonyms

  • assert.h — <assert.h> est un en tête présent dans la bibliothèque standard du langage C qui définit la macro assert. La macro met en œuvre une assertion, qui peut être utilisée pour vérifier les hypothèses formulées par le programme. La macro assert… …   Wikipédia en Français

  • assert — [ə sʉrt′] vt. [< L assertus, pp. of asserere, to join to, claim < ad , to + serere, join: see SERIES] 1. to state positively; declare; affirm 2. to maintain or defend (rights, claims, etc.) assert oneself to insist on one s rights, or on… …   English World dictionary

  • assert — as·sert /ə sərt/ vt: to present and demand recognition of assert a claim as·ser·tion /ə sər shən/ n Merriam Webster’s Dictionary of Law. Merriam Webster. 1996 …   Law dictionary

  • assert — c.1600, declare, from L. assertus, pp. of asserere claim, maintain, affirm (see ASSERTION (Cf. assertion)). Related: Asserted; asserting. To assert oneself stand up for one s rights is recorded from 1879 …   Etymology dictionary

  • assert — ► VERB 1) state (a fact or belief) confidently and forcefully. 2) cause others to recognize (something) by confident and forceful behaviour. 3) (assert oneself) be confident and forceful. ORIGIN Latin asserere claim, affirm …   English terms dictionary

  • assert — [v] insist, declare, maintain advance, affirm, allege, argue, asservate, attest, aver, avouch, avow, butt in*, cite, claim, contend, defend, horn in, justify, mouth off*, pop off*, predicate, press, proclaim, profess, pronounce, protest, put… …   New thesaurus


Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”

We are using cookies for the best presentation of our site. Continuing to use this site, you agree with this.