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.

73 lines
1.2 KiB

  1. /***
  2. *badalloc.cpp - defines C++ bad_alloc member functions
  3. *
  4. * Copyright (c) 1995-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * Defines C++ bad_alloc member functions
  8. *
  9. *Revision History:
  10. * 05-08-95 CFW Module created.
  11. * 06-23-95 CFW ANSI new handler removed from build.
  12. *
  13. *******************************************************************************/
  14. #ifdef ANSI_NEW_HANDLER
  15. #include <stddef.h>
  16. #include <new.h>
  17. //
  18. // Default constructor - initialize to blank
  19. //
  20. bad_alloc::bad_alloc()
  21. {
  22. _m_what = NULL;
  23. }
  24. //
  25. // Standard constructor: initialize with string pointer
  26. //
  27. bad_alloc::bad_alloc( const char * what )
  28. {
  29. _m_what = what;
  30. }
  31. //
  32. // Copy constructor
  33. //
  34. bad_alloc::bad_alloc ( const bad_alloc & that )
  35. {
  36. _m_what = that._m_what;
  37. }
  38. //
  39. // Assignment operator: destruct, then copy-construct
  40. //
  41. bad_alloc& bad_alloc::operator=( const bad_alloc & that )
  42. {
  43. if (this != &that)
  44. {
  45. this->bad_alloc::~bad_alloc();
  46. this->bad_alloc::bad_alloc(that);
  47. }
  48. return *this;
  49. }
  50. //
  51. // Destructor
  52. //
  53. bad_alloc::~bad_alloc()
  54. {
  55. }
  56. //
  57. // bad_alloc::what()
  58. //
  59. const char * bad_alloc::what()
  60. {
  61. return _m_what;
  62. }
  63. #endif /* ANSI_NEW_HANDLER */