Re: + initialize docs conflict?
Re: + initialize docs conflict?
- Subject: Re: + initialize docs conflict?
- From: Ali Ozer <email@hidden>
- Date: Tue, 1 Feb 2005 16:05:57 -0800
A static flag means storage, and in addition, to be totally safe, that
implies a lock to synchronize access. So a little more overhead
overall.
Ali
Begin forwarded message:
From: Bill Cheeseman <email@hidden>
Date: February 1, 2005 15:17:40 PST
To: Cocoa-Dev Mail <email@hidden>
Subject: Re: + initialize docs conflict?
on 2005-02-01 2:50 PM, Ricky Sharp at email@hidden wrote:
The typical "one-time only" implementation looks like this:
@implementation MyClass
+initialize {
if (self == [MyClass class]) {
// do something once
}
}
mmalc also pointed this out in another e-mail. I've been using this
pattern
already for +initialize in my NSControl subclasses. I plan to use
this
pattern for all my initialize code (some still use a static flag).
What is the reason to prefer this over a static flag?
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com
_______________________________________________
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