Re: Major Nubie : adding ints get strange values?
Re: Major Nubie : adding ints get strange values?
- Subject: Re: Major Nubie : adding ints get strange values?
- From: Charlton Wilbur <email@hidden>
- Date: Thu, 6 Apr 2006 08:50:47 -0400
On Apr 6, 2006, at 8:24 AM, d2kagw wrote:
im sure its something REALLY simple that i've just missed... but I
can't find anything in the net !?
Here:
- ( void ) selectChild:(int *)selectedIndex
you say that selectChild takes a pointer to an integer.
Here:
[self selectChild:( currentIndex + 1 )];
you pass it an integer.
For objects where some compile-time type checking is helpful, you use
(SomeClass *) as a type, and pass by reference. For things that
aren't objects -- int, long, float, double, bool, char -- you use
(int) [or (long), (float), (double) etc.) and pass by value.
You probably want the first message definition to be
- (void) selectChild: (int) selectedIndex
(You could also fix it by passing a pointer to integer to selectChild
every time you invoke it, since the important thing is that you pass
what you say you're going to pass, but that's a pretty backwards way
to fix it.)
Charlton
--
Charlton Wilbur
email@hidden
email@hidden
_______________________________________________
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