.\" (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de) .\" .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" License. .\" Modified Sat Jul 24 21:42:42 1993 by Rik Faith (faith@cs.unc.edu) .\" .\" Traducido al castellano (con permiso) por: .\" Sebastian Desimone (chipy@argenet.com.ar) (desimone@fasta.edu.ar) .\" Traducción revisada 25 Mayo 1998 por Carlos Costa Portela .\" Traducción revisada por Miguel Pérez Ibars el 1-enero-2005 .\" .TH ASSERT 3 "25 agosto 2002" "GNU" "Manual del Programador de Linux" .SH NOMBRE assert \- aborta el programa si la expresión es falsa. .SH SINOPSIS .nf .B #include .sp .BI "void assert (int " "expression" ");" .fi .SH DESCRIPCIÓN Si la macro .B NDEBUG estaba definida en el momento en que .B fue incluido por última vez, la macro .B assert() no genera ningún código, y por tanto no hace nada. En caso contrario, la macro .B assert() imprime un mensaje de error a la salida estándar y termina el programa llamando a .B abort() si .I expression es falsa (es decir, es igual a cero). Esto sólo sucede cuando la macro .B NDEBUG está sin definir. .LP El propósito de esta macro es ayudar al programador a encontrar fallos en su programa. El mensaje "aserto fallido en el fichero foo.c, función do_bar(), línea 1287" no es de ayuda en absoluto para un usuario. .SH "VALOR DEVUELTO" No se devuelve ningún valor. .SH "CONFORME A" ISO 9899 (ANSI C). En el estándar de 1990, .I expression debe ser de tipo .B int , teniendo un comportamiento indefinido si no es así, pero en el estándar de 1999 puede tener cualquier tipo escalar. .\" See Defect Report 107 for more details. .SH "FALLOS" .B assert() es implementada como un macro; si la expresión comprobada tiene efectos laterales, el comportamiento del programa puede ser diferente dependiendo de si .B NDEBUG está definida o no. Esto puede crear fallos indeterminados (Heisenbugs) que no se dan cuando la depuración está activada. .SH "VÉASE TAMBIÉN" .BR exit "(3), " abort (3), .BR assert_perror (3)