[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


From: Manuel Guesdon
Subject: methodSignatureForSelector:
Date: Wed, 7 Mar 2001 21:00:41 +0100 (CET)

A nice problem: methodSignatureForSelector:  seems to be broken (under 

When I ask for method signature for selector named "name:" (method 
"-(NSString*)name"), I get the good selector but calling 
 methodSignatureForSelector: to retrieve signature and next calling 
methodReturnType on this signature doesn't return
the good type: it return address@hidden:4 instead of @address@hidden:4. I think 
it takes the return type of the method "-(char*)name" (well
known method of classes objects). 

In NSObject.m:
- (NSMethodSignature*) methodSignatureForSelector: (SEL)aSelector
  const char    *types;

#ifdef __FreeBSD__
  types = NULL;
  types = aSelector->sel_types;

  if (types == 0)
      struct objc_method *mth;

      mth = (GSObjCIsInstance(self)
        ? class_get_instance_method(GSObjCClass(self), aSelector)
        : class_get_class_method(GSObjCClass(self), aSelector));
      if (mth == 0)
          return nil;
      types = mth->method_types;
  return [NSMethodSignature signatureWithObjCTypes: types];

I've made tests and using the mth instead of aSelector->sel_types works.

As far as I can see, the problem come when two methods (which have the same 
selector) return different things (in this case
an id and a char*).

What do you think ?

What is the best method to handle this ? Removing aSelector->sel_types use in 
methodSignatureForSelector: ?

May be the sel_types of SEL structure should be removed to prevent this kind of 
bug ?

Manuel Guesdon - Software Builders <address@hidden>
14 rue Jean-Baptiste Clement  -  93200 Saint-Denis  -  France
Tel: +33 1 4940 0999  -  Fax: +33 1 4940 0998

reply via email to

[Prev in Thread] Current Thread [Next in Thread]