Re: Question about floatValue on nil object
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