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



> 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.

Yes, GNustep does, and Cocoa does, and OpenStep does - but your basic
bog-standard Objective-C language as provided by GCC doesnt, because all
those things are libraries on top of Obj-C.

> If we're talking strictly about Objective-C, then @"foo" is a
> meaningless construct.

Weel, yes, also true - but GCC lets you attach a class to it as a shortcut
using the -fconstant-string-class option. So in my Makefiles I
have to have -fconstant-string-class=PFConstantString and then define
PFConstantString to be a subclass of PfString, and have no-ops for retain,
release and the rest.

It works well, though the fact that the compiler knows how to lay out
the object on the stack is a bit of a pain. If you want to define a superclass
for it then you have to be careful. I just went for some ugly hackery,
but it works nicely.

-pcf.
 _______________________________________________
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: 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.