VC++常用定义(如SAFE_DELETE等)

#ifndef SAFE_DELETE
#define SAFE_DELETE(p) { if(p){delete(p);  (p)=NULL;} }

#endif

 

#ifndef SAFE_DELETE_ARRAY

#define SAFE_DELETE_ARRAY(p) { if(p){delete[] (p);  (p)=NULL;} }

#endif

 

#ifndef SAFE_RELEASE

#define SAFE_RELEASE(p) { if(p){ (p)->Release();  (p)=NULL;} }

#endif

 

posted @ 2012-04-26 09:51  j2ee技术  阅读(383)  评论(0编辑  收藏  举报