Skip to content

Instantly share code, notes, and snippets.

@veader
Created March 15, 2012 03:02
Show Gist options
  • Save veader/2041541 to your computer and use it in GitHub Desktop.
Save veader/2041541 to your computer and use it in GitHub Desktop.
// in @interface block
@property (nonatomic, retain) NSDate *dateToView;
// in @implementation block
@synthesize dateToView = _dateToView;
- (void)setDateToView:(NSDate *)newDate {
if (_dateToView == nil || ![_dateToView isEqualToDate:newDate]) {
[_dateToView release];
_dateToView = nil;
if (newDate != nil) {
_dateToView = [newDate retain];
}
}
}
// debugger...
// LLDB ----
(lldb) po _dateToView
(NSDate *) $2 = 0x00000000 <nil>
(lldb) po self.dateToView
(NSDate *) $3 = 0x00000000 <nil>
(lldb) po newDate
(NSDate *) $4 = 0x06c56dc0 2012-03-15 00:00:00 +0000
(lldb) // after
error: '//' is not a valid command.
(lldb) po _dateToView
(NSDate *) $10 = 0x00000000 <nil>
(lldb) po self.dateToView
(NSDate *) $11 = 0x06c56dc0 2012-03-15 00:00:00 +0000
(lldb) po newDate
(NSDate *) $12 = 0x06c56dc0 2012-03-15 00:00:00 +0000
// GDB ----
(gdb) po _dateToView
Can't print the description of a NIL object.
(gdb) po self.dateToView
There is no member named dateToView.
(gdb) po newDate
2012-03-15 00:00:00 +0000
(gdb) // after
Undefined command: "". Try "help".
(gdb) po _dateToView
2012-03-15 00:00:00 +0000
(gdb) po self.dateToView
There is no member named dateToView.
(gdb) po newDate
2012-03-15 00:00:00 +0000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment