new

Go to the documentation of this file.
00001 // The -*- C++ -*- dynamic memory management header. 00002 00003 // Copyright (C) 1994, 1996, 1997, 1998, 2000, 2001, 2002 00004 // Free Software Foundation 00005 00006 // This file is part of GNU CC. 00007 // 00008 // GNU CC is free software; you can redistribute it and/or modify 00009 // it under the terms of the GNU General Public License as published by 00010 // the Free Software Foundation; either version 2, or (at your option) 00011 // any later version. 00012 // 00013 // GNU CC 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 GNU CC; see the file COPYING. If not, write to 00020 // the Free Software Foundation, 59 Temple Place - Suite 330, 00021 // Boston, MA 02111-1307, USA. 00022 00023 // As a special exception, you may use this file as part of a free software 00024 // library without restriction. Specifically, if other files instantiate 00025 // templates or use macros or inline functions from this file, or you compile 00026 // this file and link it with other files to produce an executable, this 00027 // file does not by itself cause the resulting executable to be covered by 00028 // the GNU General Public License. This exception does not however 00029 // invalidate any other reasons why the executable file might be covered by 00030 // the GNU General Public License. 00031 00038 #ifndef __NEW__ 00039 #define __NEW__ 00040 00041 #include <cstddef> 00042 #include <exception> 00043 00044 extern "C++" { 00045 00046 namespace std 00047 { 00050 class bad_alloc : public exception 00051 { 00052 public: 00053 bad_alloc() throw() { } 00054 // This declaration is not useless: 00055 // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118 00056 virtual ~bad_alloc() throw(); 00057 }; 00058 00059 struct nothrow_t { }; 00060 extern const nothrow_t nothrow; 00063 typedef void (*new_handler)(); 00065 new_handler set_new_handler(new_handler) throw(); 00066 } // namespace std 00067 00069 00079 void* operator new(std::size_t) throw (std::bad_alloc); 00080 void* operator new[](std::size_t) throw (std::bad_alloc); 00081 void operator delete(void*) throw(); 00082 void operator delete[](void*) throw(); 00083 void* operator new(std::size_t, const std::nothrow_t&) throw(); 00084 void* operator new[](std::size_t, const std::nothrow_t&) throw(); 00085 void operator delete(void*, const std::nothrow_t&) throw(); 00086 void operator delete[](void*, const std::nothrow_t&) throw(); 00087 00088 // Default placement versions of operator new. 00089 inline void* operator new(std::size_t, void* __p) throw() { return __p; } 00090 inline void* operator new[](std::size_t, void* __p) throw() { return __p; } 00091 00092 // Default placement versions of operator delete. 00093 inline void operator delete (void*, void*) throw() { }; 00094 inline void operator delete[](void*, void*) throw() { }; 00096 } // extern "C++" 00097 00098 #endif

Generated on Wed Sep 29 13:54:49 2004 for libstdc++-v3 Source by doxygen 1.3.7