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. No realloc alternative for new/deleteThe new/delete couple not have a realloc alternative that is available when you use the malloc/free pair. 因为现在是用的c++,为避免释放空间是混合new/delete和malloc/free,想找个c++中的calloc替代,结果应当是没有,上面“No realloc alternative for new/delete”,calloc应当是同样的。 |