On Wed, May 21, 2008 at 11:35 AM, Johnny Lundy <[EMAIL PROTECTED]> wrote:
> Here's why the OP was not aware of the behavior of an NSArray class method:
> Here's the verbatim documentation for +arrayWithObjects:
>
>
>> arrayWithObjects:
>> Creates and returns an array containing the objects in the argument list.
>>
>> + (id)arrayWithObjects:(id)firstObj, ...
>>
>> ParametersfirstObj, ...
>> A comma-separated list of objects ending with nil.
>>
>> Return Value
>> An array containing the objects in the argument list.
>>
>> Discussion
>> This code example creates an array containing three different types of
>> element:
>>
>> NSArray *myArray;
>> NSDate *aDate = [NSDate distantFuture];
>> NSValue *aValue = [NSNumber numberWithInt:5];
>> NSString *aString = @"a string";
>> myArray = [NSArray arrayWithObjects:aDate, aValue, aString, nil];
>> Availability
>>        • Available in Mac OS X v10.0 and later.
>> See Also
>>        • + array
>>        • + arrayWithObject:
>> Declared InNSArray.h
>
> See? Not a word about autoreleasing anything, or having to retain the
> returned array. Nada.

The "Cocoa" memory contract is almost universally applied to all of
Cocoa and related frameworks. So no point exists in stating that
something follows the expected memory contract (only the exceptions
are documented).

It is expected that you have at least looked at the getting started
documentation before you attempt to dive much into anything else. You
would quickly run across the following...

<http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaObjects/chapter_3_section_1.html#//apple_ref/doc/uid/TP40002974-CH4>

Also note any verbiage talking about retain / autorelease, etc isn't
(really) relevant if the garbage collection is being used.

-Shawn
_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to