Reason why not to have a DELETE macro for C++

前端 未结 12 984
臣服心动
臣服心动 2020-11-29 07:01

Are there any good reasons (except \"macros are evil\", maybe) NOT to use the following macros ?

#define DELETE( ptr ) \\
i         


        
12条回答
  •  有刺的猬
    2020-11-29 07:09

    1. Macros are evil. Why not use inline templated functions?
    2. You can delete null ptrs.
    3. In many cases you don't need to set the ptr to null - destructors for instance.

提交回复
热议问题