define __KERNEL_STRICT_NAMES to avoid inclusion of kernel types on systems that carry...
[cake.git] / compiler / clib / __assert.c
bloba024427b82fa0cad48b50dfa90de127af60cf220
1 /*
2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
3 $Id$
5 assert()
6 */
7 #include <assert.h>
8 #include <stdio.h>
9 #include <stdlib.h>
11 /*****************************************************************************
13 NAME
14 #include <assert.h>
16 void assert (
18 SYNOPSIS
19 expr)
21 FUNCTION
22 Evaluates the expression expr and if it's FALSE or NULL, then
23 printf a message and stops the program. The message will
24 contain the expression, the name of the file with the assert
25 in it and the line in the file.
27 INPUTS
28 expr - The expression to evaluate. The type of the expression does
29 not matter, only if its zero/NULL or not.
31 RESULT
32 The function doesn't return.
34 NOTES
36 EXAMPLE
37 // Make sure that x equals 1
38 assert (x==1);
40 BUGS
42 SEE ALSO
44 INTERNALS
45 ******************************************************************************/
46 void __assert (const char * expr, const char * file, unsigned int line)
48 fprintf (stderr, "Assertion (%s) failed in %s:%u\n", expr, file, line);
49 exit (10);
50 } /* assert */