Re: Passing numbers through userdata
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