• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Objects return nil
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Objects return nil


  • Subject: Re: Objects return nil
  • From: Tom Sutcliffe <email@hidden>
  • Date: Fri, 8 Aug 2003 02:28:57 +0100

On Thursday, August 7, 2003, at 02:09 pm, Michael Hanna wrote:

lineArray = [[NSMutableArray alloc] initWithArray:[lines tokenLines]];

Also, the NSArray returned is retrieved as an NSMutableArray. Is explicit casting necessary?

since initWithArray is defined by NSArray and only needs an array, this is fine. You rarely need to cast in Obj-C. This could however be more concisely expressed as

lineArray = [[lines tokenLines] mutableCopy]

In fact I've always wondered why NSArray even has the initWithArray method given the presence of the copy and mutableCopy methods.

Regards,

Tom
_______________________________________________
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.

References: 
 >Objects return nil (From: Michael Hanna <email@hidden>)

  • Prev by Date: Re: Random crash
  • Next by Date: Re: OS X lineending - \n or \r
  • Previous by thread: Re: Objects return nil
  • Next by thread: Re: Objects return nil
  • Index(es):
    • Date
    • Thread