On 13 Jan 2011, at 21:23, Jens Ayton wrote: > On Jan 11, 2011, at 12:51, David Chisnall wrote: >> >> GNUstep Objective-C Runtime 1.1 > > The implementation of objc_msgSend() is slightly worse than useless, and I > suggest removing it. There are two problems: > * As far as I can see, it's trying to call a struct pointer as a function. > Last I checked, this wasn't very reliable.
Yup, that was left over from an experimental ABI that was tested for Étoilé briefly. > * Unless you're calling a method which takes no parameters and returns an > object, it is necessary to typecast objc_msgSend to the appropriate > signature, and you can't cast a statement expression. The ... is just there > to confuse and frustrate people. Any working use of objc_msgSend() except > trivial test cases won't work with a macro implementation. Actually, that's not true. The IMP type is variadic, so you can call it with any arguments following the selector and it will work correctly and the compiler will generate exactly the same call frame as it would with an explicit cast. You do need to cast the function for other return types. On OS X, this is done by calling the objc_msgSend_sret() or objc_msgSend_fpret() functions in a lot of cases, although small-structure returns and 64-bit integer returns on 32-bit platforms need you to cast objc_msgSend(). I really dislike this as an API, because it means that the user has to know about the calling conventions of the target ABI, which makes portable code impossible (there are lots of issues even between PowerPC and x86 on OS X that can bite you). The GNU interface, where you get the IMP and cast it to the type you want is a lot cleaner, so I think simply removing objc_msgSend() is probably the thing to do. Calling it is probably not a good idea if you are not a compiler. I've removed the macro in svn. > Also, the comment for struct objc_property in properties.h ends partway > through a word. Ooops. Fixed in svn. David -- Sent from my IBM 1620 _______________________________________________ Discuss-gnustep mailing list [email protected] http://lists.gnu.org/mailman/listinfo/discuss-gnustep
