This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: ObjC additions (Was: Re: PROPOSAL: Objective-C++)
- From: Helge Hess <helge dot hess at skyrix dot com>
- To: Ziemowit Laski <zlaski at apple dot com>
- Cc: Ovidiu Predescu <ovidiu at cup dot hp dot com>,Stefan Urbanek <stefanurbanek at yahoo dot fr>, Kim Shrier <kim at tinker dot com>,LHelldorf at kabel dot de, discuss-gnustep at gnu dot org,discuss-gnustep-admin at gnu dot org, gcc at gcc dot gnu dot org,Stan Shebs <shebs at apple dot com>, snaroff at apple dot com,Markus Grabert <xam at student dot cs dot ucc dot ie>
- Date: Tue, 20 Nov 2001 10:04:41 +0100
- Subject: Re: ObjC additions (Was: Re: PROPOSAL: Objective-C++)
- Organization: http://www.skyrix.com
- References: <30D6CF9B-DD40-11D5-B03D-0030658361CA@apple.com>
Ziemowit Laski wrote:
> I've been working with ObjC/ObjC++ for almost a year now, and the thing I
> miss the most is the ability to instantiate ObjC classes or the stack
> or in file scope, a la C++. As I understand it, though, this may not
> be possible to accomplish since 'alloc...' is not always cleanly
> separated from 'init...' in many class implementations. Also, some
> clever syntax for initializing such objects would have to be invented.
Well, it's not syntax for it, but in libFoundation you can allocate
objects from the stack using the StackZone:
#include <Foundation/StackZone.h>
{
StackZone *zone;
id stackAllocated;
zone = [[Stack alloc] init];
stackAllocated = [[NSMutableString allocWithZone:zone] init];
}
But IMHO this makes things very complicated to track ... (what happens
if someone outside retain's the string ...)
Greetings
Helge
--
SKYRIX Software AG - http://www.skyrix.com
Web Application Technology for Enterprises