• 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: Argument not getting passed to method
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Re: Argument not getting passed to method (From: Ken Tozier <email@hidden>)

  • Prev by Date: Re: Objective-C formatting guidelines
  • Next by Date: Cocoa and dead-code stripping
  • Previous by thread: Re: Argument not getting passed to method
  • Next by thread: Objective-C formatting guidelines
  • Index(es):
    • Date
    • Thread