Re: Declaring Variables - Setting to nil VS Not Setting?
Re: Declaring Variables - Setting to nil VS Not Setting?
- Subject: Re: Declaring Variables - Setting to nil VS Not Setting?
- From: Fritz Anderson <email@hidden>
- Date: Thu, 26 Apr 2012 15:17:58 -0500
On 26 Apr 2012, at 3:00 PM, Chris Tracewell wrote:
> I usually use the sample in line 1 when declaring vars inside my methods.
You should be able to get this from any elementary book about C.
> NSString *theString = [NSString string];
Declares a variable containing a pointer to an NSString object, named theString, and fills it with an NSString pointer representing an empty string. The variable points to an object.
> NSString *theString = nil;
Declares a variable containing a pointer to an NSString object, named theString, and fills it with zero (not a pointer to anything).
> NSString *theString;
Declares a variable containing a pointer to an NSString object, named theString, and doesn't fill it with anything; the variable contains whatever junk was left in the portion of memory the variable now uses.
— F
_______________________________________________
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