This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libobjc/14382] New: [libobjc] Calling +initialize on a per category basis
- From: "d dot ayers at inode dot at" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 2 Mar 2004 12:36:59 -0000
- Subject: [Bug libobjc/14382] New: [libobjc] Calling +initialize on a per category basis
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The file libobjc/README contains the passage:
-----------------------------
+initialize
===========
...each +initialize method is called exactly once (or
never if no methods of that particular class is never called).
Besides this, it is allowed to 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 method is for other implementations, but this is
how it works for GNU Objective C.
------------------------------
Yet, currently the invocation of +initialize in libobjc is implemented to send
+initialize only once and does the method lookup manually.
This behavior is compatible to the behavior of the Apple/NeXT runtime.
There is a bug either in the documentation or on the implementation.
Personally I think the documented behavior is very useful, but it would imply
not being able to override +initialize in categories. Usually that wouldn't
make much sense as these implementations typically have two objectives:
a) insure related classes are initialized
b) initialize static globals which couldn't be initialized in a separate
category anyway.
But like I said, that's just "usually typical".
I would be in favor of "fixing" the GNU runtime implementation to correspond to
the documentation, *if* the Apple runtime would also implement this feature.
Otherwise, I'd rather "fix" the documentation to avoid code relying on
incompatible features, but I don't have a strong opinion if others think the GNU
runtime should deviate in this respect.
--
Summary: [libobjc] Calling +initialize on a per category basis
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: minor
Priority: P2
Component: libobjc
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: d dot ayers at inode dot at
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: *-*-*
GCC host triplet: *-*-*
GCC target triplet: *-*-*
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14382