discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: has my bug report & fix been submitted (in NSProcessInfo.m)?


From: Sheldon Gill
Subject: Re: has my bug report & fix been submitted (in NSProcessInfo.m)?
Date: Wed, 20 Jul 2005 12:41:34 +0800
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

Gregory,

<snip>

This isn't exactly true, as I understand it. The objc runtime sends an "initialize" message to every Class object after its been created.

Yes, and class objects (not instances of classes) should only be created once
by the runtime.

Absolutely.

As detailed in the other reply to Lloyd, the runtime (see libobjc) in sendmsg.c
sets a flag on classes that have had initialize called and only calls
initialize on classes whose flag is set to false.

Sure.

Since it is a normal message it obeys the normal rules for method lookup. Hence, the actual method called can be that of the super. Therefore it is entirely possible for an "+initialize" method to be called multiple times.

I never said initialize isn't a normal method.  You can, indeed, explicitly
call it as many times as you like.  My point is that it will only be called
once by the *runtime* when a class is first used/loaded according to the Apple
docs and the code in the gcc 3.4.3 version of libobjc.

And my point is that the *runtime* can call a particular +initialize implementation more than once due to inheritance. If ClassA implements +initialize and ClassB derives from ClassA without overriding it then that specific implementation will be called *twice*.

Apple docs, 'The Objective-C Language' page 50:
"Note that since initialize is inherited, it may be called multiple times on behalf of subclasses."

Anyway, aren't we basically in agreement about all this?


Regards,
Sheldon




reply via email to

[Prev in Thread] Current Thread [Next in Thread]