home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / misc / emu / AROSdev.lha / AROS / compiler / clib / __assert.c next >
Encoding:
C/C++ Source or Header  |  1997-01-09  |  1.1 KB  |  56 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: __assert.c,v 1.1 1996/12/13 13:51:47 digulla Exp $
  4.  
  5.     Desc: assert()
  6.     Lang: english
  7. */
  8. #include <assert.h>
  9. #include <stdio.h>
  10.  
  11. /*****************************************************************************
  12.  
  13.     NAME
  14. #include <assert.h>
  15.  
  16.     void assert (
  17.  
  18.     SYNOPSIS
  19.     expr)
  20.  
  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.
  26.  
  27.     INPUTS
  28.     expr - The expression to evaluate. The type of the expression does
  29.         not matter, only if its zero/NULL or not.
  30.  
  31.     RESULT
  32.     The function doesn't return.
  33.  
  34.     NOTES
  35.  
  36.     EXAMPLE
  37.     // Make sure that x equals 1
  38.     assert (x==1);
  39.  
  40.     BUGS
  41.  
  42.     SEE ALSO
  43.  
  44.     INTERNALS
  45.  
  46.     HISTORY
  47.     13.12.1996 digulla created
  48.  
  49. ******************************************************************************/
  50. void __assert (const char * expr, const char * file, unsigned int line)
  51. {
  52.     fprintf (stderr, "Assertion (%s) failed in %s:%u\n", expr, file, line);
  53.     /* TODO exit (10); */
  54. } /* assert */
  55.  
  56.