• 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: Question about floatValue on nil object
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about floatValue on nil object


  • Subject: Re: Question about floatValue on nil object
  • From: Andrew Farmer <email@hidden>
  • Date: Tue, 13 Sep 2005 01:54:26 -0700

On 13 Sep 05, at 01:42, Michaël Parrot wrote:
...I am suprised that [nil floatValue] don't return nil.

That's a result of the way that return values are internally handled. Most return values are either placed in r3 (integers up to 32 bits width, pointers, etc) or on the stack. Floating-point values are the exception - they're placed in a floating-point register.


When a message is sent to nil, the code in objc_msgSend doesn't know what sort of return value is expected by the caller, so it assumes that the nil return value should be placed in r3. This works in most cases, but breaks (as you observed) for floating-point values.

Incidentally, don't depend on messages to nil objects returning nil. Apple has stated that messages to nil will have undefined results (including crashes) on the x86.

Attachment: PGP.sig
Description: This is a digitally signed message part

 _______________________________________________
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

  • Follow-Ups:
    • Re: Question about floatValue on nil object
      • From: Finlay Dobbie <email@hidden>
References: 
 >Question about floatValue on nil object (From: Michaël Parrot <email@hidden>)

  • Prev by Date: RE: Web VIew?
  • Next by Date: Re: Question about floatValue on nil object
  • Previous by thread: Question about floatValue on nil object
  • Next by thread: Re: Question about floatValue on nil object
  • Index(es):
    • Date
    • Thread