On Nov 18, 2015, at 10:57 , Jens Alfke <j...@mooseyard.com> 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 (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com