Why not a procedure for retain/release?
Why not a procedure for retain/release?
- Subject: Why not a procedure for retain/release?
- From: Mark Patterson <email@hidden>
- Date: Fri, 5 Nov 2004 10:19:26 +1000
Hi,
Since NSObject properties have to be retained and released in their
setter methods, I wrote the little procedure replaceProperty
demostrated below. Is there any reason against doing this sort of
thing? I'm surprised that something done so frequently would be always
done in full.
Regards,
Mark
id replaceProperty(id old, id new)
{
[new retain];
[old release];
return new;
}// replaceProperty
//--------------------------------------------------- UCNamed
------------
@implementation UCNamed
-(NSString *) name
{
return name;
}
-(void) setName: (NSString *) val
{
name = (NSString *) replaceProperty(name, val);
}
@end // UCNamed
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden