Re: Argument not getting passed to method
Re: Argument not getting passed to method
- Subject: Re: Argument not getting passed to method
- From: Shawn Erickson <email@hidden>
- Date: Sun, 01 Jul 2007 18:23:36 -0700
On Jul 1, 2007, at 5:02 PM, Ken Tozier wrote:
I return an NSValue here rather than a plain old NSSize because the
compiler spit out a real error (not just a warning) when I define
"sizeWithWidth" like this
- (NSSize) sizeWithWidth:(float) inWidth
and call it like this:
NSSize conSize = [contentView sizeWithWidth: oldFrame.size.width];
Does that shed any light on the matter
If the compiler doesn't find the declaration for a method it assumes
the method returns id (and gives you a warning). Additionally it
assumes arguments are id which are passed in registers other then
those that would be used to pass floats.
You got an error when you tried to get an NSSize from a -
sizeWithWidth: message because the complier couldn't find -
sizeWithWidth: declared so it assuming id for return type and then it
notices that you are trying to shove the assumed id into a NSSize
struct... which isn't correct and hence an error. At least that is
what I have to guess at since you did list the compiler error.
-Shawn
_______________________________________________
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