new6.c

来自「this is a gcc file, you can download it 」· C语言 代码 · 共 24 行

C
24
字号
// Test that we properly default-initialize the new int when () is given.#include <new>using namespace std;extern "C" void *malloc (size_t);int special;int space = 0xdeadbeef;void *operator new (size_t size) throw (bad_alloc){  if (special)    return &space;  return malloc (size);}int main (){  special = 1;  int *p = new int();  special = 0;  return *p != 0;}

⌨️ 快捷键说明

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