← Back to team overview

kicad-developers team mailing list archive

Re: SAFE_DELETE

 


On 6/16/2010 11:21 PM, Dick Hollenbeck wrote:
> 
> wxstruct.h
> 
> //C++ guarantees that operator delete checks its argument for null-ness
> #ifndef SAFE_DELETE
> #define SAFE_DELETE( p ) delete (p); (p) = NULL;
> #endif
> 
> 
> 1) what is this?
> 
> 2) why it is needed?
> 
> 3) why cannot i put it after an if() statement (trick question)?
> 
> 
> I don't like it.

And it's redundant as there is a wxDELETE() macro defined in wxWidgets
which you can safely put after an if() statement.  It is defined in
wx/defs.h along with a lot of other very handy definitions that hide
platform and compiler differences.  Many of them are not well documented
so you may need to grep the source code.

Wayne

> 
> Dick
> 
> 
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
> 



References