• 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: Passing numbers through userdata
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Passing numbers through userdata


  • Subject: Re: Passing numbers through userdata
  • From: Clark Cox <email@hidden>
  • Date: Wed, 15 Dec 2004 14:13:40 -0500

On Wed, 15 Dec 2004 07:31:56 -0800, Larry Fransson
<email@hidden> wrote:
>
> On Dec 15, 2004, at 06:54, Fritz Anderson wrote:
>
> >> If I pass an int directly through the userdata property, I get the
> >> problem "warning: passing arg 3 of
> >> `addTrackingRect:owner:userData:assumeInside:' makes pointer from
> >> integer without a cast" However, it does work, even though when I
> >> retrieve the int I get the warning, "assignment makes integer from
> >> pointer without a cast"
> >
> > You could cast the integer to void * (as in userData: (void *) myInt),
> > but it is bad karma to use pointer storage for integers (and vice
> > versa, as when you do the reverse cast at the other end).
>
> Why not pass &myInt?  Wouldn't that work?

Only if you could be sure that myInt wouldn't go away or change values
before the call to -mouseEntered:. (i.e. It can't be a local variable
on the stack, etc.).

--
Clark S. Cox III
email@hidden
http://www.livejournal.com/users/clarkcox3/
http://homepage.mac.com/clarkcox3/
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Passing numbers through userdata (From: Christopher Drum <email@hidden>)
 >Re: Passing numbers through userdata (From: Fritz Anderson <email@hidden>)
 >Re: Passing numbers through userdata (From: Larry Fransson <email@hidden>)

  • Prev by Date: Using Security framework to get root auth for running app.
  • Next by Date: Re: Using Security framework to get root auth for running app.
  • Previous by thread: Re: Passing numbers through userdata
  • Next by thread: Substituting low level BSD stuff with spiffy Cocoa calls
  • Index(es):
    • Date
    • Thread