And I quote from MSDN http://msdn.microsoft.com/en-us/library/aa366533(VS.85).aspx:
The malloc function has the
disadvantage of being run-time
dependent. The new operator has the
disadvantage of being compiler
dependent and language dependent.
Now the questions folks:
a) What do we mean that malloc is run-time dependent? What kind of dynamic memory allocation functions can be independent of run-time? This statement sounds real strange.
b) new is language dependent? Of course it should be right? Are HeapAlloc, LocalAlloc etc language independent?
c) From a pure performance perspective are the MSVC provided routines preferable?
Arpan
a) In this case I think they’re eliding “run-time library” to “run-time”. In other words it depends on the implementation in your C library.
b) Indeed new is C++ specific. HeapAlloc, etc are technically usable in C and C++.
c) They can’t be used to create C++ objects because they won’t call constructors so the point is pretty moot. In C++ you should use new and delete.