Documentation


assertions.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           assertions.h  -  description
00003                              -------------------
00004     begin                : Wed Jan 14 2004
00005     copyright            : (C) 2004 by Mathieu Coquerelle
00006     email                : mathieu.coquerelle@imag.fr
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00021  #ifndef _ASSERTIONS_H
00022  #define _ASSERTIONS_H
00023  
00024  #include <cassert>
00025 #include <stdio.h>
00026  
00027  #ifndef NDEBUG
00028 // We want debugging stuff
00029 
00030  #define Require( expr ) \
00031   (__ASSERT_VOID_CAST ((expr) ? 0 : fprintf( stderr, "Require: %s failed in %s:%s at line %d\n", \
00032                                                                         __STRING( expr ), __FILE__, __ASSERT_FUNCTION, __LINE__) ) )
00033 
00034  #define Ensure( expr ) \
00035   (__ASSERT_VOID_CAST ((expr) ? 0 : fprintf( stderr, "Ensure: %s failed in %s:%s at line %d\n", \
00036                                                                         __STRING( expr ), __FILE__, __ASSERT_FUNCTION, __LINE__) ) )
00037 
00038                                   
00039 #else
00040 
00041     #define Require( expr ) ;
00042     #define Ensure( expr ) ;
00043     
00044  #endif
00045 
00046  #endif
00047 
00048 

Generated on Thu Dec 23 13:52:23 2004 by doxygen 1.3.6