For faster navigation, this Iframe is preloading the Wikiwand page for 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 español), que implementa una aserción (test), usada para comprobar suposiciones en el programa:

#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 evalúa 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 que se incluyen la condición 'test', el nombre del archivo fuente y el número de línea en la que se llamó a assert() mediante las macros estándar predefinidas __FILE__ y __LINE__, respectivamente), adicionalmente a partir 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 sintaxis:

void assert(int test);

Véase también

[editar]
{{bottomLinkPreText}} {{bottomLinkText}}
assert.h
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?