Re: Simple scope check.
Re: Simple scope check.
- Subject: Re: Simple scope check.
- From: Sandro Noel <email@hidden>
- Date: Sat, 9 Dec 2006 19:53:52 -0500
Well, thank you, for taking the time.
you did in fact understand my question even tough it did not make
sense :)
i wanted to know if in fact i was "over releasing" i just didn't know
how to phrase it properly...
i'm sorry about that.
Sandro.
On 9-Dec-06, at 7:44 PM, Shawn Erickson wrote:
On Dec 9, 2006, at 4:14 PM, Sandro Noel wrote:
Greetings,
i was just wondering if Cocoa behaved like other languages
concerning variable scope.
i did search the documentation for variable scope but all i get
back is the references for Apple Scripts ...
so... in this function.
+ (NSString *)numberFizzle: (NSNumber *) input{
NSString *intToStr = [ [ [NSString alloc] stringWithFormat:@"%d",
[input intValue]] autorelease];
NSString *tempStr = [ [ [NSString alloc] stringWithFormat:@"i%d:%
d", [intToStr length], [input intValue]] autorelease];
NSLog(tempStr);
return tempStr;
}
You are over releasing in the above and your questions don't really
make sense. Also scoping of local vars is the same as in C and are
independent of object life times (since Objective-C doesn't support
stack based objects).
Please review the following carefully...
<http://developer.apple.com/documentation/Cocoa/Conceptual/
MemoryMgmt/index.html>
-Shawn
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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