Re: Returning values from objc_msgSend etc
Re: Returning values from objc_msgSend etc
- Subject: Re: Returning values from objc_msgSend etc
- From: Ronald Oussoren <email@hidden>
- Date: Mon, 03 Mar 2008 03:10:40 -0800
On Monday, March 03, 2008, at 11:53AM, "Duncan McGregor" <email@hidden> wrote:
>> I can simply check the calculated size after calling ffi_prep_cif(), and compare that to sizeof(void*) to see if the return value will fit in a register.
>
>Is that right? 8 byte structs are returned in EAX and EDX on IA-32, so
>I'd expect to call objc_msgSend.
The rules are a bit more complex than this (at least on x86). Small structs are returned in registers (upto 8 bytes), but only if the size of the struct is a power of 2. That is, a 6-byte struct will not be returned in registers. I haven't checked recently if the ABI documentation reflects reality, in 10.4 days it didn't.
Ronald
_______________________________________________
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