gnustep-dev
[Top][All Lists]
Advanced

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

NSMethodSignature


From: Marcus Müller
Subject: NSMethodSignature
Date: Tue, 16 Apr 2002 01:11:09 +0200

Hi,

it seems there's a slight incompatibilty in the way NSMethodSignatures are constructed on Mac OS X and GNUstep. I've made a test which shows that NSMethodSignatures on Mac OS X are actually the same objects if they describe the same signature (returnType, types, nargs, sizeOfParams, returnValueLength). On GNUstep, they're not the same objects. As a positive side-effect due to the nature of the OS X implementation Apple doesn't need to implement isEqual: as NSObject's implementation will do. On GNUstep, however, this leads to the fact that *all* NSMethodSignatures can never be equal to each other.

My proposal is this implementation of isEqual: for NSMethodSignature:


- (BOOL)isEqual:(id)other
{
  BOOL isEqual = YES;
  if (other == nil)
    {
      return NO;
    }
  if (((NSMethodSignature *)other)->isa != isa)
    {
      return NO;
    }
isEqual = [self numberOfArguments] == [other numberOfArguments] && [self frameLength] == [other frameLength] && *[self methodReturnType] == *[other methodReturnType] && [self isOneway] == [other isOneway];
  if(isEqual == NO)
    {
      return NO;
    }
  else
    {
      int i, n;
      n = [self numberOfArguments];
      for(i = 0; i < n; i++)
        {
if ( (*[self getArgumentTypeAtIndex:i] == *[other getArgumentTypeAtIndex:i]) == NO)
            {
              return NO;
            }
        }
    }
  return isEqual;
}

@end


Cheers,

  Marcus


--
Marcus Mueller  .  .  .  crack-admin/coder ;-)
Mulle kybernetiK  .  http://www.mulle-kybernetik.com
Current projects: finger address@hidden




reply via email to

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