//哈哈,与国际接轨了
摘要:malloc,free和new delete不能混用! |
|
Otherwise, malloc() and free() are not to be used in C++ code because they don't support object semantics. Furthermore, the results of calling free() to release an object that was allocated by new, or of using delete to release memory that was allocated by malloc(), are undefined. The C++ standard doesn't guarantee that the underlying implementation of operator new uses malloc(); in fact, on some implementations malloc() and new use different heaps | |
[此贴子已经被作者于2005-10-18 22:34:45编辑过]