Does the stack-based idiom allow returning an autoreleased object?  I'd
think you'd end up with code like this:

- (id)arrayWithStuff {
  StackAutoreleasePool();
  NSArray *array = [NSArray arrayWithObjects:obj1, obj2, etc, nil];
  return array;
}

which would essentially translate into:

- (id)arrayWithStuff {
  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
  NSArray *array = [NSArray arrayWithObjects:obj1, obj2, etc, nil];
  [pool release];
  return array;  // array is dead
}

Is there some reason why this would not happen?

-BJ
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to