Re: How to avoid warning with objc_msgSend
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