• 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: Analyzer Questions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Analyzer Questions


  • Subject: Re: Analyzer Questions
  • From: Wade Tregaskis <email@hidden>
  • Date: Tue, 02 Feb 2010 12:26:01 -0800

> - (CGPDFDocumentRef)getPDFDocumentRef:(const char *)filename {
> 	CGPDFDocumentRef	document;
>
>        snip...
>
> 	document = CGPDFDocumentCreateWithURL(url);
> 	return document;
> }

The CF convention is that functions and methods that return a literal reference to an object - that is, the caller doesn't receive ownership of it - use the verb "get", as you have above.  Functions and methods which do return ownership use the "copy" or "create" verbs.

Clang Static Analyzer uses these cues to decide what it thinks you should be doing.  If you rename your above method to createPDFDocumentRef:, you should find it's a lot less confused.

Wade
_______________________________________________

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

References: 
 >Analyzer Questions (From: Bob Barnes <email@hidden>)

  • Prev by Date: Re: Custom Field Editor Problem
  • Next by Date: Re: HELP! My app crashes on startup, with a very weird stack trace.
  • Previous by thread: Re: Analyzer Questions
  • Next by thread: Buttons in Xcode's Data Model Window
  • Index(es):
    • Date
    • Thread