Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: objc_msgSend problems on x86




Greg Parker wrote :

Don't do this. In the BOOL case it works, I think. In other cases it fails (for example, if you cast to double instead of BOOL). Using an appropriately-typed function pointer always works.

According to the objc-runtime.h header, one must use objc_msgSend_fpret on i386 for methods returning a double value :


/* Floating-point-returning Messaging Primitives (prototypes)
*
* On some platforms, the ABI for functions returning a floating-point
* value is incompatible with that for functions returning an integral type.
* objc_msgSend_fpret must be used for these.
*
* ppc: objc_msgSend_fpret not used
* ppc64: objc_msgSend_fpret not used
* i386: objc_msgSend_fpret REQUIRED
*
* For `float` or `long double` return types, cast the function
* to an appropriate function pointer type first.
*/


#ifdef __i386__
OBJC_EXPORT double objc_msgSend_fpret(id self, SEL op, ...);
#endif


-- Damien Bobillot

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: objc_msgSend problems on x86 (From: Greg Parker <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.