Erg Consultant wrote:

Oddly, the object returned is non-nil.

I should mention that the pointer being returned is a hack global declared at the top of the file like this:

static Registry *gReg = nil;

but that shouldn't matter.

Post your code for alloc and -init.

Your question can only be answered by seeing the actual code. Without actual code, everyone is just guessing.


And I've checked that that global is never set to nil or created twice anywhere else in the code.

If your intention is to always return a singleton Registry, you need to follow the pattern for "Creating a Singleton Instance" in the Cocoa-Fundamentals docs.

http://developer.apple.com/documentation/Cocoa/Conceptual/ CocoaFundamentals/CocoaObjects/CocoaObjects.html#//apple_ref/doc/uid/ TP40002974-CH4-SW32

If it is not your intention to always return a singleton Registry, then returning "a hack global" is probably doing it wrong.

  -- GG

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to