Does dynamic memory allocation differ in C and C++ in popular implementations?

后端 未结 5 914
情书的邮戳
情书的邮戳 2020-12-04 12:17

As far as the respective language standards go, C offers dynamic memory allocation only through the malloc() family, while in C++ the most common form of alloca

5条回答
  •  暖寄归人
    2020-12-04 12:37

    In most implementations operator new() just calls malloc(). In fact even The Standard suggests that as a default stratege. Of course you can implement your own operator new, usually for a class if you want better performance, but the default is usually just calling malloc().

提交回复
热议问题