<分区>
定义一个转换为 C++ 的 new 和 C 的 malloc 的宏是常见的做法吗? (以及等效的删除/释放宏)
<分区>
定义一个转换为 C++ 的 new 和 C 的 malloc 的宏是常见的做法吗? (以及等效的删除/释放宏)
最佳答案
Is it common practice to define a macro that translates to new for C++ and malloc for C? (And an equivalent delete/free macro)
没有。
I was wondering if such a thing is common practice because I have never seen it in use in any programs but I can't think of any reason why it would be a bad thing to do
C 不是 C++。 C++ 不是 C。绝对没有理由这样做。
关于C++/C语言独立内存分配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20363456/