• 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
Declaring Variables - Setting to nil VS Not Setting?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Declaring Variables - Setting to nil VS Not Setting?


  • Subject: Declaring Variables - Setting to nil VS Not Setting?
  • From: Chris Tracewell <email@hidden>
  • Date: Thu, 26 Apr 2012 13:00:58 -0700

I usually use the sample in line 1 when declaring vars inside my methods.

NSString *theString = [NSString string];
NSString *theString = nil;
NSString *theString;

I thought lines 2 and 3 were the same thing. I was wrong. What is the difference and when do you use the style shown in line 3?

Thanks and pointers to docs are welcome.

--chris
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Declaring Variables - Setting to nil VS Not Setting?
      • From: Sean McBride <email@hidden>
    • Re: Declaring Variables - Setting to nil VS Not Setting?
      • From: Nick Zitzmann <email@hidden>
    • Re: Declaring Variables - Setting to nil VS Not Setting?
      • From: David Duncan <email@hidden>
    • Re: Declaring Variables - Setting to nil VS Not Setting?
      • From: Fritz Anderson <email@hidden>
  • Prev by Date: Re: DataSource modified while TableView is displaying data
  • Next by Date: Re: Declaring Variables - Setting to nil VS Not Setting?
  • Previous by thread: Re: Using Instruments to profile UITableView drawing
  • Next by thread: Re: Declaring Variables - Setting to nil VS Not Setting?
  • Index(es):
    • Date
    • Thread