Guest User

Untitled

a guest
Jan 12th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. Check if a variable has been claimed by garbage collector
  2. // C++ example.
  3. int* foo = NULL;
  4. foo = new int;
  5. delete foo;
  6. foo = NULL;
  7.  
  8. if(foo) // Does this pointer actually point to something?
  9.  
  10. #define SAFE_DELETE(ptr) if(ptr) { delete ptr; ptr = NULL; }
Add Comment
Please, Sign In to add comment