This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]