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

📄 new1.c

📁 gcc-you can use this code to learn something about gcc, and inquire further into linux,
💻 C
字号:
// PR c++/5757// Test that when a constructor throws in a new-expression, we pass the// right pointer to operator delete.// { dg-do run }#include <new>int ret = 1;void *ptr;void * operator new[] (size_t s) throw (std::bad_alloc){  ptr = operator new (s);  return ptr;}void operator delete[] (void *p) throw (){  if (p == ptr)    ret = 0;  operator delete (p);}struct A{  A() { throw 1; }  ~A() {}};intmain (){  try    {      A *p = new A[4];    }  catch (...) {}  return ret;}

⌨️ 快捷键说明

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