Re: [ANN] Mulle kybernetiK - Optimizing Objective-C code - Articles #3.1 + #9 online
Re: [ANN] Mulle kybernetiK - Optimizing Objective-C code - Articles #3.1 + #9 online
- Subject: Re: [ANN] Mulle kybernetiK - Optimizing Objective-C code - Articles #3.1 + #9 online
- From: Andrew Pinski <email@hidden>
- Date: Tue, 30 Dec 2003 19:00:13 -0500
@implementation StackbasedObject
+ (id) alloc
{
StackbasedObject *p;
size_t size;
size = ((struct objc_class *) self)->instance_size;
p = alloca( size);
p->isa = self;
memset( &(p->isa + 1), 0, size - sizeof( Class));
return( p);
}
DO NOT USE, this will not work.
alloca only allocates memory for the stack in that function so it will
become invalid as you return from the alloc message.
Thanks,
Andrew Pinski
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.