Assert.h

Assert.h

assert.h

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 comprobar suposiciones en el progrma:

#define assert ( test )

Esta macro se expande como un bloque "if", en el que se comprueba la condición 'test' y, dependiendo de si es o no verdadera, puede abortar el programa.

Si 'test' se evalua como cero(es decir, si es falsa) entonces se aborta el programa mediante la función abort () y se imprime un mensaje en stderr en el qu se incluyen la condición 'test', el nombre del archivo fuente y el número de línea en la qe se llamó a asert() mediante las macros estándar predefinidas __FILE__ y __LINE__, respectivamente), adicionalmente a patir de la versión C99 se incluye el nombre de la función que se estaba ejecutando (mediante la macro __func__).

Si se coloca la directiva #define NDEBUG (no depurar) en el archivo fuente antes de incluir assert.h, entonces la macro se definirá como:

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

Lo que provoca que ésta no tenga ningún efecto en el programa. Algunos compiladores simplemente convierten todas las aserciones en comentarios.

Ejemplo de sintáxis:

void assert(int test);

Véase también

Obtenido de "Assert.h"

Wikimedia foundation. 2010.

Игры ⚽ Нужен реферат?

Mira otros diccionarios:

  • 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 — 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… …   Wikipedia

  • 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

Compartir el artículo y extractos

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