• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
calling method via IMP that returns non id type - compiler warning
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

calling method via IMP that returns non id type - compiler warning


  • Subject: calling method via IMP that returns non id type - compiler warning
  • From: Ben Dougall <email@hidden>
  • Date: Sun, 15 Feb 2004 16:59:00 +0000

i've used an IMP to call a method, and that method returns a typedeffed type that isn't an object pointer -- not an id type that is. it all works fine apart from it gives a warning. if i cast the returned value from the IMP call the warning goes away -- but is that the way to fix that?

so at the moment i'm using the IMP like so:

typedef u_int8_t *MyType;

...

MyType result = theMethodIMP(object, nil, value);

and the method that the IMP stands for/points to is declared like this:

- (MyType)theMethod:(unsigned)value;

the above IMP call line gives this warning:
warning: assignment from incompatible pointer type

but changing the IMP call line to:

MyType result = (MyType)theMethodIMP(object, nil, value);

stops the warning. is that how i should stop the warning, or is there some other way i should be using?

thanks, ben.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: calling method via IMP that returns non id type - compiler warning
      • From: "b.bum" <email@hidden>
  • Prev by Date: Re: [NSString UTF8String] performance
  • Next by Date: Re: NSTableView row counter
  • Previous by thread: Re: [NSString UTF8String] performance
  • Next by thread: Re: calling method via IMP that returns non id type - compiler warning
  • Index(es):
    • Date
    • Thread