p3579.c

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

C
40
字号
// prms-id: 3579extern "C" int printf(const char *, ...);int num_x;class Y {public:  Y () { printf("Y()            this: %x\n", this); }  ~Y () { printf("~Y()           this: %x\n", this); }};class X {public:  X () {    ++num_x;    printf("X()            this: %x\n", this);    Y y;    *this = (X) y;  }  X (const Y & yy) { printf("X(const Y&)    this: %x\n", this); ++num_x; }  X & operator = (const X & xx) {    printf("X.op=(X&)      this: %x\n", this);    return *this;  }  ~X () { printf("~X()           this: %x\n", this); --num_x; }};int main (int, char **) {    { X anX; }    if (num_x) {      printf("FAIL\n");      return 1;    }    printf("PASS\n");    return 0;};

⌨️ 快捷键说明

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