|
From: | David Ayers |
Subject: | Re: Is +[NSMutableArray initialize] completely implemented? |
Date: | Fri, 27 Feb 2004 19:06:49 +0100 |
User-agent: | Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6) Gecko/20040113 |
Andrew Pinski wrote:
On Feb 22, 2004, at 06:26, David Ayers wrote:Kazunobu Kuriyama wrote:Though this seems to be a dated document, gcc/objc/README of GCC's source tells<quote> +initialize ===========This method, if defined, is called before any other instance or class methods of that particular class. This method is not inherited, and is thus not called as initializer for a subclass that doesn't define it itself. Thus, each +initialize method is called once (or never if no methods of that particular class is nevercalled).Besides this, it is allowed ot have several +initialize methods, one for each category. The order in which these (multiple methods) are called is not well defined. I am not completely certain what the semantics of this methods isfor other implementations, but this is how it works for GNU Objective C. <unquote>Ahh! Thanks, that's probably where I had read it and was later confused to find that it doesn't work that way. AFAIK the Apple/NeXT runtimes also don't call +initialize per category. So I think the comment needs to be fixed.
[snip]
Can you file a bug <http://gcc.gnu.org/bugs.html>, I think the intended behavioris to have them both called. I will be looking into this.
Well, I can, and if only for documentation purposes. But I have been able to verify that the NeXT/Apple Runtime behave the same way.
Personally I would like the feature that +initialize be called on a per category basis, as it makes some things a whole lot easier for me (esp. wrt to GDL2, (if we could change this for gcc 3.5 and make it a prerequisite for GDL2... haha!))
But it does have implications wrt being able to overwrite the default implementation. Yet I agree, that that is rather dubious and will hardly ever be able to do the Right Thing, if you consider that usually you just insure that related classes get initialized and static locals get initialized that you can't set from outside the compilation unit anyway.
Yet I think this is an issue for objc-language@ so I'll prepare a post. I strongly think it would only make sense if we change it in both runtimes if we change it at all.
Cheers, DavidPS: Didn't get around to the bug report and formulating the objc-language@ post today, but I should on the weekend.
[Prev in Thread] | Current Thread | [Next in Thread] |