• 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
Re: How to avoid warning with objc_msgSend
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to avoid warning with objc_msgSend


  • Subject: Re: How to avoid warning with objc_msgSend
  • From: Finlay Dobbie <email@hidden>
  • Date: Tue, 5 Oct 2004 17:15:36 +0100


On 5 Oct 2004, at 09:46, Ryan Norton wrote:

Anyhow, assuming that GetNSView() is a function returning a pointer to an NSViewInstance, why don't you just send it normally?

id aView = GetNSView();
NSRect *rects;
int rectCount;
[aView getRectsBeingDrawn:&rects count:&rectCount];

Because this generates both a runtime and compiler warning on 10.2 and lower (using the id instead of a plain GetNSView generates an extra compiler warning also) :).

Then do this:

id aView = GetNSView();
NSRect *rects = NULL;
int rectCount = 0;
if ([aView respondsToSelctor:@selector(getRectsBeingDrawn:count:)]) {
[aView getRectsBeingDrawn:&rects count:&rectCount];
}

That obviously won't cause a runtime warning on 10.2 and lower. It'll cause a compile-time warning, removing that would be an exercise for the reader (hint: define a protocol, but this is really bad practice as those methods aren't really implemented and thus the warning is perfectly valid).

-- Finlay

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
  • Follow-Ups:
    • Re: How to avoid warning with objc_msgSend
      • From: David Elliott <email@hidden>
References: 
 >Re: How to avoid warning with objc_msgSend (From: Ryan Norton <email@hidden>)

  • Prev by Date: Re: Equivelent to drawRect: for drawing after sub views are drawn
  • Next by Date: Re: Embedding Omni Frameworks
  • Previous by thread: Re: How to avoid warning with objc_msgSend
  • Next by thread: Re: How to avoid warning with objc_msgSend
  • Index(es):
    • Date
    • Thread