Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
1.6 KiB

  1. // new standard header
  2. #ifndef _NEW_
  3. #define _NEW_
  4. #include <exception>
  5. #ifdef _MSC_VER
  6. #pragma pack(push,8)
  7. #endif /* _MSC_VER */
  8. _STD_BEGIN
  9. // CLASS bad_alloc
  10. class _CRTIMP2 bad_alloc : public exception {
  11. public:
  12. bad_alloc(const char *_S = "bad allocation") _THROW0()
  13. : exception(_S) {}
  14. virtual ~bad_alloc() _THROW0()
  15. {}
  16. protected:
  17. virtual void _Doraise() const
  18. {_RAISE(*this); }
  19. };
  20. // SUPPORT TYPES
  21. struct nothrow_t {};
  22. extern _CRTIMP2 const nothrow_t nothrow;
  23. _STD_END
  24. typedef void (__cdecl *new_handler)();
  25. extern new_handler _New_hand;
  26. // new AND delete DECLARATIONS
  27. void __cdecl operator delete(void *) _THROW0();
  28. void *__cdecl operator new(size_t) _THROW1(std::bad_alloc);
  29. void *__cdecl operator new(size_t, const std::nothrow_t&)
  30. _THROW0();
  31. #if _MSC_VER >= 1200 /*IFSTRIP=IGN*/
  32. #if defined(_WIN64) /*IFSTRIP=IGN*/
  33. void __cdecl operator delete(void *,
  34. const std::nothrow_t&) _THROW0();
  35. #else
  36. inline void __cdecl operator delete(void * pv, const std::nothrow_t&)
  37. {::delete(pv);}
  38. #endif
  39. #endif
  40. #ifndef __PLACEMENT_NEW_INLINE
  41. #define __PLACEMENT_NEW_INLINE
  42. inline void *__cdecl operator new(size_t, void *_P)
  43. {return (_P); }
  44. #if _MSC_VER >= 1200 /*IFSTRIP=IGN*/
  45. inline void __cdecl operator delete(void *, void *)
  46. {return; }
  47. #endif
  48. #endif
  49. #ifdef _CRTIMP
  50. _CRTIMP
  51. #endif
  52. new_handler __cdecl set_new_handler(new_handler) _THROW0();
  53. #ifdef _MSC_VER
  54. #pragma pack(pop)
  55. #endif /* _MSC_VER */
  56. #endif /* _NEW_ */
  57. /*
  58. * Copyright (c) 1994 by P.J. Plauger. ALL RIGHTS RESERVED.
  59. * Consult your license regarding permissions and restrictions.
  60. */