discuss-gnustep
[Top][All Lists]
Advanced

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

Re: a question using performv


From: Adam Fedor
Subject: Re: a question using performv
Date: Mon, 25 Feb 2002 11:11:08 -0700
User-agent: Mozilla/5.0 (X11; U; Linux ppc; en-US; rv:0.9.7) Gecko/20020120

]d wrote:

outputs

I am wondering if the usage of
               target performv:_cmd :__builtin_apply_args()];



The gcc __builtin functions are not really portable (they are essentially broken on non-ix86 machines), but they should work for simple cases, at least.

I'm not sure why you want to implement a class that could act as it's own delegate, but I might suggest an alternate implementation with an 'Invocation' class (like GNUstep's NSInvocation) with a target set to 'MyClass' which actually does the work. Then in Invocation, you can just implement forward::

- (retval_t) forward:(SEL)aSel :(arglist_t)argFrame
{
 if (target)

    return [target performv: aSel : argFrame];
}

int main()
{
  MyClass *x1 = [[[Myclass alloc] init]setIden:1];
  Invcation *invoke = [[Invocation alloc] initWithTarget: x1];
  [invoke printnumber:123 :456];
}

The internal functionality of forward:: still uses the __builtin functions, though.

--
Adam Fedor, Digital Optics Corp.      | I'm glad I hate spinach, because
http://www.doc.com                    | if I didn't, I'd eat it, and you
                                      | know how I hate the stuff.




reply via email to

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