home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_122 / 1.ddi / CLIBSRC.ZIP / NEWF.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  653 b   |  30 lines

  1. /*-----------------------------------------------------------------------*
  2.  * filename - newf.cpp
  3.  * C++ NEW
  4.  *-----------------------------------------------------------------------*/
  5.  
  6. /*
  7.  *      C/C++ Run Time Library - Version 5.0
  8.  *
  9.  *      Copyright (c) 1990, 1992 by Borland International
  10.  *      All Rights Reserved.
  11.  *
  12.  */
  13.  
  14.  
  15. #include <stddef.h>
  16. #include <alloc.h>
  17.  
  18. typedef void (*pvf)();
  19.  
  20. extern pvf _new_handler;
  21.  
  22. void far * operator new( unsigned long size )
  23. {
  24.     void far * p;
  25.     size = size ? size : 1;
  26.     while ( (p = farmalloc(size)) == NULL && _new_handler != NULL)
  27.         _new_handler();
  28.     return p;
  29. }
  30.