libgcc/
[official-gcc.git] / libstdc++-v3 / libsupc++ / new_handler.cc
blob3580acb097713c6a12f811a3da6bf0acda5824b4
1 // Implementation file for the -*- C++ -*- dynamic memory management header.
3 // Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 // 2005, 2006, 2007
5 // Free Software Foundation
6 //
7 // This file is part of GCC.
8 //
9 // GCC is free software; you can redistribute it and/or modify
10 // it under the terms of the GNU General Public License as published by
11 // the Free Software Foundation; either version 2, or (at your option)
12 // any later version.
14 // GCC is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 // GNU General Public License for more details.
19 // You should have received a copy of the GNU General Public License
20 // along with GCC; see the file COPYING. If not, write to
21 // the Free Software Foundation, 51 Franklin Street, Fifth Floor,
22 // Boston, MA 02110-1301, USA.
24 // As a special exception, you may use this file as part of a free software
25 // library without restriction. Specifically, if other files instantiate
26 // templates or use macros or inline functions from this file, or you compile
27 // this file and link it with other files to produce an executable, this
28 // file does not by itself cause the resulting executable to be covered by
29 // the GNU General Public License. This exception does not however
30 // invalidate any other reasons why the executable file might be covered by
31 // the GNU General Public License.
33 #include "new"
35 const std::nothrow_t std::nothrow = { };
37 using std::new_handler;
38 new_handler __new_handler;
40 new_handler
41 std::set_new_handler (new_handler handler) throw()
43 new_handler prev_handler = __new_handler;
44 __new_handler = handler;
45 return prev_handler;
48 std::bad_alloc::~bad_alloc() throw() { }
50 const char*
51 std::bad_alloc::what() const throw()
53 return "std::bad_alloc";