• 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: Assigning an element of a swift array to a userdata parameter triggers didSet
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Assigning an element of a swift array to a userdata parameter triggers didSet


  • Subject: Re: Assigning an element of a swift array to a userdata parameter triggers didSet
  • From: Quincey Morris <email@hidden>
  • Date: Wed, 18 Nov 2015 11:12:06 -0800
  • Feedback-id: 167118m:167118agrif8a:167118spuspKQuYv:SMTPCORP

On Nov 18, 2015, at 10:57 , Jens Alfke <email@hidden> wrote:
>
> Doesn’t the pointer become invalid as soon as myElement goes out of scope? (There’s a reason that type is called *Unsafe*Pointer…)

Yes, but so does &myArray[0] in the original code. According to your hypothesis, it’s copied into a temporary, which also becomes invalid as soon as the current scope ends.

(I didn’t check the docs to see if the void* parameter to addToolTipRect needs a longer lifetime. If it does, then there’s manual memory management to do, regardless of what approach is taken. That’s why there ought to be a better API.)

_______________________________________________

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: Assigning an element of a swift array to a userdata parameter triggers didSet
      • From: John McCall <email@hidden>
References: 
 >Assigning an element of a swift array to a userdata parameter triggers didSet (From: Eric Gorr <email@hidden>)
 >Re: Assigning an element of a swift array to a userdata parameter triggers didSet (From: Jens Alfke <email@hidden>)
 >Re: Assigning an element of a swift array to a userdata parameter triggers didSet (From: Eric Gorr <email@hidden>)
 >Re: Assigning an element of a swift array to a userdata parameter triggers didSet (From: Quincey Morris <email@hidden>)
 >Re: Assigning an element of a swift array to a userdata parameter triggers didSet (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: Assigning an element of a swift array to a userdata parameter triggers didSet
  • Next by Date: Re: Assigning an element of a swift array to a userdata parameter triggers didSet
  • Previous by thread: Re: Assigning an element of a swift array to a userdata parameter triggers didSet
  • Next by thread: Re: Assigning an element of a swift array to a userdata parameter triggers didSet
  • Index(es):
    • Date
    • Thread