new Expression versus operator new Function

C++ Primer 4/e在Optimizing Memory Allocation这个地方有一个术语:‘

The library functions operator new and operator delete are misleadingly named. Unlike other operator functions, such as operator=, these functions do not overload the new or delete expressions. In fact, we cannot redefine the behavior of the new and delete expressions.

A new expression executes by calling an operator new function to obtain memory and then constructs an object in that memory. A delete expression executes by destroying an object and then calls an operator delete function to free the memory used by the object.

警告

Because the new (or delete) expressions and the underlying library functions have the same name, it is easy to confuse the two.’

中文版的这样写:‘程式库提供的operator new的函式和operator delete函式,其名称很容易带来混淆。不同于其他operator 函式(例如operator=),上述两函式并没有对new或delete算式进行重载。事实上我们不能重新定义new算式和delete算式的行为。

new算式的行为包括呼叫operator new函式取得记忆体,然后在该记忆体建构一个物件。delete算式的行为包括销毁一个物件并呼叫operator delete函式以释放物件所用的记忆体。

警告

由于new(或delete)算式及其底层所用函式的名称相同,两者很容易被混淆。’