CoCoALib-0.9905 date: 23 May 2007


assert.H

Go to the documentation of this file.
00001 #ifndef CoCoA_assert_H
00002 #define CoCoA_assert_H
00003 
00004 //   Copyright (c)  2005  John Abbott
00005 
00006 //   This file is part of the source of CoCoALib, the CoCoA Library.
00007 
00008 //   CoCoALib is free software; you can redistribute it and/or modify
00009 //   it under the terms of the GNU General Public License (version 2)
00010 //   as published by the Free Software Foundation.  A copy of the full
00011 //   licence may be found in the file COPYING in this directory.
00012 
00013 //   CoCoALib is distributed in the hope that it will be useful,
00014 //   but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 //   GNU General Public License for more details.
00017 
00018 //   You should have received a copy of the GNU General Public License
00019 //   along with CoCoA; if not, write to the Free Software
00020 //   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021 
00022 
00023 namespace CoCoA
00024 {
00025 
00026   void AssertionFailed(const char* const cond, const char* const file, unsigned long line);
00027 
00028 } // end of namespace CoCoA
00029 
00030 
00031 // The CoCoA_ASSERT macro checks conditions only if compilation is with the
00032 // CoCoA_DEBUG flag set; if the flag is not set, the macro does nothing
00033 // whatsoever (not even evaluating its argument).  After compiling with
00034 // CoCoA_DEBUG set, the executable checks that the condition is true;
00035 // if not, it calls CoCoA::AssertionFailed which prints out a useful message.
00036 #ifndef CoCoA_DEBUG
00037 #define CoCoA_ASSERT(cond) static_cast<void>(0)
00038 #else
00039 #define CoCoA_ASSERT(cond) do { if (!(cond)) CoCoA::AssertionFailed(#cond, __FILE__, __LINE__); } while(0)
00040 #endif
00041 
00042 
00043 // RCS header/log in the next few lines.
00044 // $Header: /Volumes/Home/cocoa/cvs-repository/CoCoALib-0.99/include/CoCoA/assert.H,v 1.1.1.1 2007/03/09 15:16:11 abbott Exp $
00045 // $Log: assert.H,v $
00046 // Revision 1.1.1.1  2007/03/09 15:16:11  abbott
00047 // Imported files
00048 //
00049 // Revision 1.2  2006/12/06 17:17:44  cocoa
00050 // -- removed #include "config.H"
00051 //
00052 // Revision 1.1  2006/10/06 14:04:57  cocoa
00053 // The new assert header and implementation files.
00054 // A new test.
00055 //
00056 //
00057 
00058 #endif

Generated on Wed May 23 13:45:22 2007 for CoCoALib by  doxygen 1.4.6