discuss-gnustep
[Top][All Lists]
Advanced

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

problems with forward invocation (gcc bug?)


From: woudshoo
Subject: problems with forward invocation (gcc bug?)
Date: Sun, 29 Jul 2001 19:07:49 +0200 (CEST)

The forwarding in GNUstep does not work the way I expected. 
I expected that  the line
   
    [objectinstance method: argument];

where `objectinstance' does not respond to `method:' 
would cause the runtime + GNUstep  to invoke 
`forwardInvocation:'.   But it does not.  It will throw an exception
instead complaining about missing type info for the selecter. 

This is indeed the case.  The problem is caused by the fact that 
for statically resolved selectors the field 
`SEL->sel_types'  equals NULL.
For selectors created by `NSSelectorFromString ()' the
`sel_types' field is filled in.   The program appended to the end produces
the following output:

t1 = <0x8059b38>, t1->sel_id = <0x120030>, t1->sel_types = <(null)>
t2 = <0x8079c18>, t2->sel_id = <0x120030>, t2->sel_types = <v12@0:4i8>

So the statically resolved selectors are different from the dynamically resolved
selectors.  (Of course the sel_id 's are the same.)

The missing `sel_types' seems a bug to me.  (Possibly gcc)    
Configuration:
os: linux
gcc:  3.0 thread model posix.
base: cvs from a few days ago.

---PROGRAM--
#import <Foundation/Foundation.h>

@interface SelTest: NSObject
- (void) test: (int) a;
@end

@implementation SelTest
- (void) test: (int) a;
{
}
@end
int main (void)
{
  SEL t1 = @selector (test:);
  SEL t2 = NSSelectorFromString (@"test:");


  printf ("t1 = <%p>, t1->sel_id = <%p>, t1->sel_types = <%s>\n",
          t1, t1->sel_id, t1->sel_types);

  printf ("t2 = <%p>, t2->sel_id = <%p>, t2->sel_types = <%s>\n",
          t2, t2->sel_id, t2->sel_types);

  return 0;
}







reply via email to

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