X
xmllmx
Dear all,
As we know, the C++ standard defines at least four special global
functions as follows:
1) void* operator new(size_t);
2) void* operator new[](size_t);
3) void operator delete(void*);
4) void operator delete[](void*);
In Visual C++, 2) and 4) simply forward their respective call to 1)
and 3). Obviously, 1) and 3) are equivalents respectively to malloc
and free in C. However, when and why should we call 2) and 4)?
Though 2) and 4) are not harmful, but I think them rather ugly.
Because I can not find any necessity of them.
I hope someone can give me a convincing explanation? Thanks in
advance!
As we know, the C++ standard defines at least four special global
functions as follows:
1) void* operator new(size_t);
2) void* operator new[](size_t);
3) void operator delete(void*);
4) void operator delete[](void*);
In Visual C++, 2) and 4) simply forward their respective call to 1)
and 3). Obviously, 1) and 3) are equivalents respectively to malloc
and free in C. However, when and why should we call 2) and 4)?
Though 2) and 4) are not harmful, but I think them rather ugly.
Because I can not find any necessity of them.
I hope someone can give me a convincing explanation? Thanks in
advance!