⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 new

📁 可仿真51单片机
💻
字号:
/*
 * C++ Library file new
 * Copyright 1993-2001 ARM Limited. All rights reserved.
 */

/*
 * RCS $Revision: 1.7.2.4 $
 * Checkin $Date: 2001/09/24 09:24:01 $
 * Revising $Author: vkorstan $
 */

/*
 * Combined headers for armcpp and armedg compiler
 */
 
/* Edison Design Group, 1992. */
/*
new.h -- Include file for C++ default operator new (see ARM 12.5).
*/

#ifndef __NEW
#define __NEW

#ifndef _EXCEPTION
#include <exception>
#endif /* _EXCEPTION */

#ifdef __EDG_RUNTIME_USES_NAMESPACES
namespace std {
#endif /* ifdef __EDG_RUNTIME_USES_NAMESPACES */

typedef unsigned int size_t;   /* see <stddef.h> */

/* This lets users disable the EDG supplied exception classes. */
#ifndef __NO_EDG_EXCEPTION_CLASSES

class bad_alloc : public exception {
public:
      bad_alloc() throw();
      bad_alloc(const bad_alloc&) throw();
    bad_alloc& operator=(const bad_alloc&) throw();
    virtual ~bad_alloc() throw();
    virtual const char* what() const throw();
};

#endif /* ifndef __NO_EDG_EXCEPTION_CLASSES */

  typedef void (*new_handler)();
  new_handler set_new_handler(new_handler);
  struct nothrow_t { };
  // Declaration of object nothrow to permit the use of the placement new
  // syntax: new (nothrow) T;
  extern const nothrow_t nothrow;

#ifdef __EDG_RUNTIME_USES_NAMESPACES
}  /* namespace std */

#ifdef __EDG_IMPLICIT_USING_STD
/* Implicitly include a using directive for the STD namespace when this
   preprocessing flag is TRUE. */
using namespace std;
#endif /* ifdef __EDG_IMPLICIT_USING_STD */

#endif /* ifdef __EDG_RUNTIME_USES_NAMESPACES */

#ifdef __EDG__

#ifndef __EDG_STD_NAMESPACE
/* If not already defined, define a macro that expands to the namespace
   containing the standard library. */
#ifdef __EDG_RUNTIME_USES_NAMESPACES
#define __EDG_STD_NAMESPACE std
#else /* ifndef __EDG_RUNTIME_USES_NAMESPACES */
#define __EDG_STD_NAMESPACE /* nothing */
#endif /* ifdef __EDG_RUNTIME_USES_NAMESPACES */
#endif /* ifdef __EDG_STD_NAMESPACE */

/* Normal operator new. */
void *operator new(__EDG_STD_NAMESPACE::size_t) throw(__EDG_STD_NAMESPACE::bad_alloc);

/* Normal operator delete. */
void operator delete(void*) throw ();

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

/* Nothrow version of operator delete. */
void operator delete(void*, const __EDG_STD_NAMESPACE::nothrow_t&) throw();

/* Placement new. */
inline void *operator new(__EDG_STD_NAMESPACE::size_t, void* ptr) throw() { return ptr; }

/* Placement delete. */
#ifdef __PLACEMENT_DELETE
void operator delete(void*, void*) throw();
#endif /* ifdef __PLACEMENT_DELETE */

#ifdef __ARRAY_OPERATORS

/* Array new. */
void *operator new[](__EDG_STD_NAMESPACE::size_t) throw(__EDG_STD_NAMESPACE::bad_alloc);

/* Array delete. */
void operator delete[](void*) throw ();

/* Placement array new. */
inline void *operator new[](__EDG_STD_NAMESPACE::size_t, void* ptr) throw() { return ptr; }

/* Placement array delete. */
#ifdef __PLACEMENT_DELETE
void operator delete[](void*, void*) throw();
#endif /* ifdef __PLACEMENT_DELETE */

/* Nothrow version of array new. */
void *operator new[](__EDG_STD_NAMESPACE::size_t,
                     const __EDG_STD_NAMESPACE::nothrow_t&) throw();

/* Nothrow version of array delete. */
void operator delete[](void*,
                       const __EDG_STD_NAMESPACE::nothrow_t&) throw();
#endif /* __ARRAY_OPERATORS */

#else  /* not __EDG__*/

inline void *operator new(size_t, void* ptr) { return ptr; }
inline void *operator new[](size_t, void* ptr) { return ptr; }

void *operator new(size_t, const nothrow_t&) throw();
void *operator new[](size_t, const nothrow_t&) throw();

#endif /* __EDG__ */

#endif /*__NEW */

/* End of new */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -