cowper: really? The new[] operator function alloctes 5 bytes of memory. Isn't that's exactly what an array is? (how on earth should one otherwise allocate an array on the heap in C?)
//edit
tried changing the code to this:
class test{public: void* operator new( size_t sz ) { cout << "Allocating " << sz << " bytes" << endl; return ::new test; } void* operator new[]( size_t sz ) { cout << "Allocating " << sz << " bytes" << endl; return ::new test[sz/sizeof(test)]; } void operator delete( void* ptr, size_t sz ) { cout << "Freeing " << sz << " bytes" << endl; ::delete ptr; } void operator delete[]( void* ptr, size_t sz ) { cout << "Freeing " << sz << " bytes" << endl; ::delete[] ptr; } char onebyte;};
which still produced the same results;
-Luctus
Statisticly seen, most things happens to other people. [Mail] [edited by - Luctus on February 20, 2004 7:01:13 PM]
-LuctusIn the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move - Douglas Adams