home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / crt / src / dbgnew.cpp < prev    next >
C/C++ Source or Header  |  1998-06-17  |  1KB  |  51 lines

  1. /***
  2. *dbgnew.cpp - defines C++ new() routines, debug version
  3. *
  4. *       Copyright (c) 1995-1997, Microsoft Corporation.  All rights reserved.
  5. *
  6. *Purpose:
  7. *       Defines C++ new() routines.
  8. *
  9. *******************************************************************************/
  10.  
  11. #ifdef _DEBUG
  12.  
  13. #include <cruntime.h>
  14. #include <malloc.h>
  15. #include <mtdll.h>
  16. #include <dbgint.h>
  17.  
  18. /***
  19. *void * operator new() - Get a block of memory from the debug heap
  20. *
  21. *Purpose:
  22. *       Allocate of block of memory of at least size bytes from the heap and
  23. *       return a pointer to it.
  24. *
  25. *       Allocates any type of supported memory block.
  26. *
  27. *Entry:
  28. *       unsigned int    cb          - count of bytes requested
  29. *       int             nBlockUse   - block type
  30. *       char *          szFileName  - file name
  31. *       int             nLine       - line number
  32. *
  33. *Exit:
  34. *       Success:  Pointer to memory block
  35. *       Failure:  NULL (or some error value)
  36. *
  37. *Exceptions:
  38. *
  39. *******************************************************************************/
  40. void * operator new(
  41.         unsigned int cb,
  42.         int nBlockUse,
  43.         const char * szFileName,
  44.         int nLine
  45.         )
  46. {
  47.         return _nh_malloc_dbg( cb, 1, nBlockUse, szFileName, nLine );
  48. }
  49.  
  50. #endif  /* _DEBUG */
  51.