overridding new and delete operators



Hi - I have a question regarding override of new and delete in visual studio
..NET 2003

I have overriden the operators globally as follows, as I have code which
expects NULL to be returned when memory fails to be allocated rather than
catching an exception

My question is do I also need to override new[] and delete[]. It looks as
though the compiler is already generating calls to my new and delete
functions.
//

// Function : operator new OVERRIDE

//

// Purpose : Override the "throwing" new operator

// : to make it return NULL on failure.

//

// Returns : void*

//

// Parameter : size_t size

//

void *__cdecl operator new(size_t size) _THROW1(std::bad_alloc)

{

void* pAlloc = malloc(size);

return pAlloc;

}





//

// Function : operator delete OVERRIDE

//

// Purpose : Override delete to free memory

// : allocated by the new override.

//

// Returns : void

//

// Parameter : none

//

void __cdecl operator delete(void* pAlloc) _THROW0()

{

free(pAlloc);

}



Many Thanks

Paul G


.