1// The -*- C++ -*- dynamic memory management header.
2// Copyright (C) 1994, 96-97, 1998 Free Software Foundation
3
4#ifndef __NEW__
5#define __NEW__
6
7#pragma interface "new"
8#include <stddef.h>
9#include <exception>
10
11extern "C++" {
12
13namespace std {
14
15  class bad_alloc : public exception {
16  public:
17    virtual const char* what() const throw() { return "bad_alloc"; }
18  };
19
20  struct nothrow_t {};
21  extern const nothrow_t nothrow;
22  typedef void (*new_handler)();
23  new_handler set_new_handler (new_handler);
24
25} // namespace std
26
27// replaceable signatures
28void *operator new (size_t) throw (std::bad_alloc);
29void *operator new[] (size_t) throw (std::bad_alloc);
30void operator delete (void *) throw();
31void operator delete[] (void *) throw();
32void *operator new (size_t, const std::nothrow_t&) throw();
33void *operator new[] (size_t, const std::nothrow_t&) throw();
34void operator delete (void *, const std::nothrow_t&) throw();
35void operator delete[] (void *, const std::nothrow_t&) throw();
36
37// default placement versions of operator new
38inline void *operator new(size_t, void *place) throw() { return place; }
39inline void *operator new[](size_t, void *place) throw() { return place; }
40} // extern "C++"
41
42#endif
43