/** -*- C++ -*-
 **
 **  KAI C++ Compiler
 **
 **  Copyright (C) 1996-2001 Intel Corp. All rights reserved.
 **/
#ifndef __KAI_NEW
#define __KAI_NEW

#include <mcompile.h>
#include <cstddef>	/* Needed for std::size_t */
#include <exception>	/* Needed for base class of bad_alloc */

namespace std {

  // The constant nothrow permits the placement new syntax: new (nothrow) T;
  struct nothrow_t { };
  const nothrow_t nothrow = {};

  typedef void (*new_handler)();
  new_handler set_new_handler(new_handler);
  // The underscore form is for backwards compatibility to Cfront.
  typedef new_handler __new_handler;

  class bad_alloc : public exception {
  public :
    bad_alloc() MSIPL_THROW { }
    bad_alloc(const bad_alloc& ) MSIPL_THROW { }
    bad_alloc& operator=(const bad_alloc& exarg) MSIPL_THROW { return *this; };
    virtual ~bad_alloc() MSIPL_THROW;
    virtual const char* what() const MSIPL_THROW;

    static void __throw( );
  };

}  /* namespace std */

// Usual operator new 
void *operator new(std::size_t) MSIPL_THROW_STR(std::bad_alloc);

// Nothrow version
void *operator new(std::size_t, const std::nothrow_t&) throw();

// Inline placement form added by ADR.  
// See section 18.4.1.3 of ANSI 4/28/95 Draft. 
inline void *operator new(std::size_t, void* where) MSIPL_THROW {return where;}

#ifdef __ARRAY_OPERATORS
// Array versions of above
void *operator new[](std::size_t) MSIPL_THROW_STR(std::bad_alloc);
void *operator new[](std::size_t, const std::nothrow_t&) throw();
inline void *operator new[](std::size_t, void* where) MSIPL_THROW {return where;}
#endif /*__ARRAY_OPERATORS*/

// Placement delete not implemented in EDG 2.3[0-3] .

#endif /* __KAI_NEW */
