The main differences, aside from syntax and free
vs. delete
, are
- you can portably replace
::operator new
; malloc
comes withrealloc
, for whichnew
has no equivalent;new
has the concept of anew_handler
, for which there is nomalloc
equivalent.
(Replacing malloc
opens up a can of worms. It can be done, but not portably, because it requires knowledge of the linker.)