Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: custom class init question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: custom class init question



On 8 May 2007, at 16:42, Christopher Lee wrote:

GNUstep does in fact support release and autorelease (it's the GPL version of Cocoa), just for some reason, the default implementation of NXConstantString doesn't respond to it at all.

NXConstantString isn't part of GNUstep, it's (as b.bum described) associated with the GNU objective-c runtime and is the default class for constant strings. However, GNUstep-make does something like this:


gcc main.m -c \
-MMD -MP -DGNUSTEP -DGNUSTEP_BASE_LIBRARY=1 - DGNU_GUI_LIBRARY=1 -DGNU_RUNTIME=1 -DGNUSTEP_BASE_LIBRARY=1 - D_REENTRANT -fPIC -DGSWARN -DGSDIAGNOSE -g -O2 -fno-strict-aliasing - fgnu-runtime -fconstant-string-class=NSConstantString -I/addresses- for-gnustep-0.4.6/Frameworks -I. -I/usr/local/lib/GNUstep/Local/ Library/Headers -I/usr/local/lib/GNUstep/Network/Library/Headers -I/ usr/lib/GNUstep/System/Library/Headers \
-o shared_obj/main.o


the important bit of which is -fconstant-string- class=NSConstantString. So a _GNUstep_ program actually uses NSConstantString as the class for constant strings. NXConstantString and NSConstantString have the same in-memory layout, but NSConstantString is a subclass of NSString so inherits the NSString API, so it does respond to release or autorelease (why release a constant string though?).

Cheers,
Graham.


_______________________________________________ Do not post admin requests to the list. They will be ignored. Objc-language mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Re: custom class init question (From: Pete French <email@hidden>)
 >Re: custom class init question (From: Christopher Lee <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.