Leaked source code of windows server 2003
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.

113 lines
3.1 KiB

  1. // new standard header for Microsoft
  2. #pragma once
  3. #ifndef _NEW_
  4. #define _NEW_
  5. #include <exception>
  6. #pragma pack(push,8)
  7. #pragma warning(push,3)
  8. #pragma push_macro("new")
  9. #undef new
  10. _STD_BEGIN
  11. // CLASS bad_alloc
  12. class bad_alloc
  13. : public exception
  14. { // base of all bad allocation exceptions
  15. public:
  16. bad_alloc(const char *_Message = _MESG("bad allocation")) _THROW0()
  17. : exception(_Message)
  18. { // construct from message string
  19. }
  20. virtual ~bad_alloc() _THROW0()
  21. { // destroy the object
  22. }
  23. #if !_HAS_EXCEPTIONS
  24. protected:
  25. virtual void _Doraise() const
  26. { // perform class-specific exception handling
  27. _RAISE(*this);
  28. }
  29. #endif /* _HAS_EXCEPTIONS */
  30. };
  31. // SUPPORT TYPES
  32. #if !defined(_INC_NEW) || !defined(_MSC_EXTENSIONS)
  33. typedef void (__cdecl *new_handler)(); // handler for operator new failures
  34. #endif
  35. #ifndef __NOTHROW_T_DEFINED
  36. struct nothrow_t
  37. { // placement new tag type to suppress exceptions
  38. };
  39. extern const nothrow_t nothrow; // constant for placement new tag
  40. #endif /* __NOTHROW_T_DEFINED */
  41. // FUNCTION AND OBJECT DECLARATIONS
  42. _CRTIMP2 new_handler __cdecl set_new_handler(new_handler)
  43. _THROW0(); // establish alternate new handler
  44. _STD_END
  45. // new AND delete DECLARATIONS (NB: NOT IN std)
  46. void __cdecl operator delete(void *) _THROW0();
  47. void *__cdecl operator new(size_t) _THROW1(std::bad_alloc);
  48. #ifndef __PLACEMENT_NEW_INLINE
  49. #define __PLACEMENT_NEW_INLINE
  50. inline void *__cdecl operator new(size_t, void *_Where) _THROW0()
  51. { // construct array with placement at _Where
  52. return (_Where);
  53. }
  54. inline void __cdecl operator delete(void *, void *) _THROW0()
  55. { // delete if placement new fails
  56. }
  57. #endif /* __PLACEMENT_NEW_INLINE */
  58. #ifndef __PLACEMENT_VEC_NEW_INLINE
  59. #define __PLACEMENT_VEC_NEW_INLINE
  60. inline void *__cdecl operator new[](size_t, void *_Where) _THROW0()
  61. { // construct array with placement at _Where
  62. return (_Where);
  63. }
  64. inline void __cdecl operator delete[](void *, void *) _THROW0()
  65. { // delete if placement array new fails
  66. }
  67. #endif /* __PLACEMENT_VEC_NEW_INLINE */
  68. void __cdecl operator delete[](void *) _THROW0(); // delete allocated array
  69. void *__cdecl operator new[](size_t)
  70. _THROW1(std::bad_alloc); // allocate array or throw exception
  71. #ifndef __NOTHROW_T_DEFINED
  72. #define __NOTHROW_T_DEFINED
  73. void *__cdecl operator new(size_t, const std::nothrow_t&)
  74. _THROW0(); // allocate or return null pointer
  75. void *__cdecl operator new[](size_t, const std::nothrow_t&)
  76. _THROW0(); // allocate array or return null pointer
  77. void __cdecl operator delete(void *, const std::nothrow_t&)
  78. _THROW0(); // delete if nothrow new fails -- REPLACEABLE
  79. void __cdecl operator delete[](void *, const std::nothrow_t&)
  80. _THROW0(); // delete if nothrow array new fails -- REPLACEABLE
  81. #endif /* __NOTHROW_T_DEFINED */
  82. #if !defined(_INC_NEW) || !defined(_MSC_EXTENSIONS)
  83. using std::new_handler;
  84. #endif
  85. #pragma pop_macro("new")
  86. #pragma warning(pop)
  87. #pragma pack(pop)
  88. #endif /* _NEW_ */
  89. /*
  90. * Copyright (c) 1992-2001 by P.J. Plauger. ALL RIGHTS RESERVED.
  91. * Consult your license regarding permissions and restrictions.
  92. V3.10:0009 */