[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ObjC additions (Was: Re: PROPOSAL: Objective-C++)

From: Helge Hess
Subject: Re: ObjC additions (Was: Re: PROPOSAL: Objective-C++)
Date: Tue, 20 Nov 2001 10:04:41 +0100

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

SKYRIX Software AG - http://www.skyrix.com
Web Application Technology for Enterprises

reply via email to

[Prev in Thread] Current Thread [Next in Thread]