2009-06-03 Richard Guenther <rguenther@suse.de>
[official-gcc.git] / libstdc++-v3 / libsupc++ / new_handler.cc
blob6d17a6f6c0a96428bbdbdf4c8bd61cd7c50a3281
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, 2009
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 3, 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 // Under Section 7 of GPL version 3, you are granted additional
20 // permissions described in the GCC Runtime Library Exception, version
21 // 3.1, as published by the Free Software Foundation.
23 // You should have received a copy of the GNU General Public License and
24 // a copy of the GCC Runtime Library Exception along with this program;
25 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
26 // <http://www.gnu.org/licenses/>.
28 #include "new"
30 const std::nothrow_t std::nothrow = { };
32 using std::new_handler;
33 new_handler __new_handler;
35 new_handler
36 std::set_new_handler (new_handler handler) throw()
38 new_handler prev_handler = __new_handler;
39 __new_handler = handler;
40 return prev_handler;
43 std::bad_alloc::~bad_alloc() throw() { }
45 const char*
46 std::bad_alloc::what() const throw()
48 return "std::bad_alloc";