FROM : Finlay Dobbie
DATE : Tue Oct 05 18:15:36 2004
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
DATE : Tue Oct 05 18:15:36 2004
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
| Related mails | Author | Date |
|---|---|---|
| Ryan Norton | Oct 5, 02:11 | |
| Andrew Pinski | Oct 5, 02:15 | |
| m | Oct 5, 02:32 | |
| John C. Randolph | Oct 5, 06:32 | |
| Ryan Norton | Oct 5, 10:46 | |
| m | Oct 5, 11:34 | |
| Glenn Andreas | Oct 5, 16:01 | |
| Finlay Dobbie | Oct 5, 18:15 | |
| David Elliott | Oct 5, 20:28 | |
| Shawn Erickson | Oct 5, 20:55 |






Cocoa mail archive

