Re: Static Analyzer Question
Re: Static Analyzer Question
- Subject: Re: Static Analyzer Question
- From: Jens Alfke <email@hidden>
- Date: Tue, 29 Sep 2009 17:31:40 -0700
On Sep 29, 2009, at 5:12 PM, Steve Cronin wrote:
"…. Object with +0 retain counts returned to caller where a +1
(owning) retain count is expected"
this is shown at the end of a particular method.
I think this means the method has a name that by convention indicates
that it returns a reference the caller must release — i.e. a prefix of
"alloc" or "copy" or "mutableCopy"
+ (NSString *) fooBar {
NSString *result = @"";
…..
if (x) {
result = @"1";
...
} else {
result = @"2";
}
return result;
}
What's the actual name (not 'fooBar')?
Why does Clang believe that an 'owning retain count is expected' if
the method is never called?
Objective-C is a dynamic enough language that there is no way to tell
at compile time whether a method is reachable or not. Even if that
selector never appears in your code, it could be constructed at
runtime, or your code could load a plugin bundle that calls that
selector.
—Jens_______________________________________________
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