kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #04889
Re: SAFE_DELETE
Dick Hollenbeck wrote:
> //C++ guarantees that operator delete checks its argument for null-ness
> #ifndef SAFE_DELETE
> #define SAFE_DELETE( p ) delete (p); (p) = NULL;
> #endif
[...]
> 3) why cannot i put it after an if() statement (trick question)?
BTW, do you know this trick to make multiple statements in a macro
if-safe ?
#define MACRO do { ...stuff... } while (0)
BTW2, wxDELETE is better, but still not safe with else. At
least you'd get a warning.
4) What problem - real or imagined - is the #ifdef masking ?
> I don't like it.
Looks fishy indeed.
- Werner
References