This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

operator new[] and operator delete[]


Hi,
I've overloaded the new, delete, new[] and delete[] operators in a C++
class defined as:

static void * operator new (size_t size);
		static void operator delete (void *p);
		
		static void * operator new[] (size_t size);
		static void operator delete[] (void *p);


I've noticed if I do:

Object *o = new Object[100];

It calls new[] but if I do

delete o;

later it calls delete and therefore isn't symmetrical.  How can I get
delete[] called?

gcc version 4.0.1 (Apple Computer, Inc. build 5367)


thanks,
wes


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]