[ create a new paste ] login | about

Project: ncu
Link: http://ncu.codepad.org/VUoCr4Vk    [ raw code | output | fork ]

GiM - C++, pasted on Jun 10:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* GiM */
#include <cstdio>
#include <cstdlib>

struct Test {
  Test() { puts("in ctor"); }
  ~Test() { puts("in dtor"); }
  int foo;
};

int main(int argc, char **argv)
{
  Test *foo = (Test*)calloc(1, sizeof(Test));
  foo = new (foo) (Test);
  //foo->Test::~Test();

  delete foo;

  puts ("OH HI!");
  return 1;
}


Output:
1
2
3
in ctor
in dtor
OH HI!


Create a new paste based on this one


Comments: