home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / GCC / GERLIB_USR08B.LHA / gerlib / support / g++include / new.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-12  |  895 b   |  36 lines

  1. /* Thu Sep 30 22:22:43 1993 GM: changed some things for amiga */
  2.  
  3. #ifndef _new_h
  4. #ifdef __GNUG__
  5. #pragma interface
  6. #endif
  7. #define _new_h 1
  8.  
  9. #include <stddef.h>
  10. #include <std.h>
  11.  
  12. #ifndef NO_LIBGXX_MALLOC
  13. #define MALLOC_ALIGN_MASK   7 /* ptrs aligned at 8 byte boundaries */
  14. #define MALLOC_MIN_OVERHEAD 4 /* 4 bytes of overhead per pointer */
  15. #endif
  16.  
  17. typedef void (*new_handler_t)();
  18. extern new_handler_t __new_handler;
  19. extern "C" void default_new_handler();
  20. extern "C" new_handler_t set_new_handler(new_handler_t);
  21.  
  22. #ifdef __GNUG__
  23. #define NEW(where) new { where }
  24. #endif
  25.  
  26. // default placement version of operator new
  27. static inline void *operator new(size_t, void *place) { return place; }
  28.  
  29. // provide a C++ interface to vector-resize via realloc
  30. inline void *operator new(size_t size, void *ptr, size_t new_len)
  31. {
  32.   return realloc(ptr, new_len * size);    // should work with our realloc
  33. }
  34.  
  35. #endif
  36.