]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Added comments to the definition of IMP
authorNicola Pero <nicola@gcc.gnu.org>
Thu, 12 Sep 2002 17:28:47 +0000 (17:28 +0000)
committerNicola Pero <nicola@gcc.gnu.org>
Thu, 12 Sep 2002 17:28:47 +0000 (17:28 +0000)
From-SVN: r57072

libobjc/objc/objc.h

index 79b2519e5765a223ab267a2d2171869af43f1fd2..699542c493bc694ae695d62c85032e5cfdba4ce0 100644 (file)
@@ -73,7 +73,14 @@ typedef struct objc_object {
 
 /*
 ** Definition of method type.  When retrieving the implementation of a
-** method, this is type of the pointer returned
+** method, this is type of the pointer returned.  The idea of the
+** definition of IMP is to represent a 'pointer to a general function
+** taking an id, a SEL, followed by other unspecified arguments'.  You
+** must always cast an IMP to a pointer to a function taking the
+** appropriate, specific types for that function, before calling it -
+** to make sure the appropriate arguments are passed to it.  The code
+** generated by the compiler to perform method calls automatically
+** does this cast inside method calls.
 */
 typedef id (*IMP)(id, SEL, ...);