opt26.c
来自「开放源码的编译器open watcom 1.6.0版的源代码」· C语言 代码 · 共 47 行
C
47 行
#include "fail.h"
#pragma inline_depth(0)
int operations;
struct B {
void *operator new( unsigned ){++operations;return 0;};
void operator delete( void *, unsigned ){++operations;};
virtual ~B(){++operations;};
};
struct D : B {
void *operator new( unsigned ){++operations;return 0;}
void operator delete( void *, unsigned ){++operations;}
};
struct E : B {
void *operator new( unsigned ){++operations;return 0;}
void operator delete( void *, unsigned ){++operations;}
~E() {
++operations;
}
};
struct F : B {
void *operator new( unsigned ){++operations;return 0;}
void operator delete( void *, unsigned ){++operations;}
virtual ~F() {
++operations;
}
};
int main() {
new D;
new E;
new F;
new D[3];
new E[3];
new F[3];
{D x;}
{E x;}
{F x;}
{D x[2];}
{F x[2];}
{E x[2];}
if( operations != 18 ) fail( __LINE__ );
_PASS;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?