TITLE: Delete operator versus operator delete PROBLEM: cory@shell.portal.com (Coryphaeus - Software) The ARM seems to be unclear about the order of evaluation between an operator delete and its destructor. p 575-576 "Destructors are invoked implicitly ....(3) through use of the delete operator ..... When invoked by the delete operator memory is freed by the destructor for the most derived class of the object using an operator delete." p 578 "A destructor finds the operator delete() to use for freeing store using the usual scope rules." These two seem to contradict. RESPONSE: rmartin@rcmcon.com (Robert Martin), 23 Sept 94 No, but they are confusing. There is a difference between "the delete operator" and "operator delete()". The "delete operator" is invoked by the 'delete' keyword. It then calls the destructor, and then calls "operator delete". You see? There are three (3) different functions employed here. There is an interaction between the 'delete operator', the destructor, and 'operator delete' that is not obvious. I can psuedo code it as follows: 'delete operator'( Object* o) { void* p; // will hold address of buffer to delete; size_t s; // will hold size of buffer to delete; o->Object::~Object(p,s); // pass in references to these variables // that the destructor will load. operator delete(p,s); // Tell operator delete the address and size // of the block to be deleted. } This strange piece of pseudo code is trying to make the point that the 'delete operator' procures both the address and size of the allocated memory from the destructor of the object. However, these values cannot be correct unless the most derived destructor is executed. Thus, in the general case, the destructor must be a virtual function.