NetBSD/gnu/lib/libg++/g++-include/new.h
1993-03-21 09:45:37 +00:00

34 lines
782 B
C

#ifndef _new_h
#ifdef __GNUG__
#pragma once
#pragma interface
#endif
#define _new_h 1
#include <stddef.h>
#include <std.h>
#ifndef NO_LIBGXX_MALLOC
#define MALLOC_ALIGN_MASK 7 /* ptrs aligned at 8 byte boundaries */
#define MALLOC_MIN_OVERHEAD 8 /* 8 bytes of overhead per pointer */
#endif
typedef void (*new_handler_t)();
extern "C" void default_new_handler();
extern "C" new_handler_t set_new_handler(new_handler_t);
#ifdef __GNUG__
#define NEW(where) new { where }
#endif
// default placement version of operator new
static inline void *operator new(size_t, void *place) { return place; }
// provide a C++ interface to vector-resize via realloc
static inline void *operator new(size_t size, void *ptr, size_t new_len)
{
return realloc(ptr, new_len * size);
}
#endif