It sounds like a bug in the GNU Objective-C Runtime, most likely this one --
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16110 It's on my list for GCC 4.6.0. But please note that (in practice) most likely you want to use +load as little as possible. Almost anything else works more reliably. ;-) Thanks -----Original Message----- From: "Andreas Kostler" <[email protected]> Sent: Friday, 8 October, 2010 09:21 To: [email protected] Subject: Categories, NSString and +load Hello everyone, Please help me on this one. The code snippet below output 1 0 Hence, [NSObject load] gets called, [NSString load] doesn't. Can anyone explain this behaviour? Kind Regards #include <Foundation/NSString.h> #include <Foundation/NSAutoreleasePool.h> static int a = 0; static int b = 0; @implementation NSObject (objectCategory) +(void)load { a = 1; } @end @implementation NSString (stringCategory) + (void)load { b = 1; } @end int main() { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSLog (@"%d", a); NSLog (@"%d", b); [pool release]; } _______________________________________________ Discuss-gnustep mailing list [email protected] http://lists.gnu.org/mailman/listinfo/discuss-gnustep _______________________________________________ Discuss-gnustep mailing list [email protected] http://lists.gnu.org/mailman/listinfo/discuss-gnustep
