FROM : Jakob Olesen
DATE : Tue Aug 01 09:35:02 2006
On 31/07/2006, at 13.58, Fredrik Olsson wrote:
> Even typecasting as;
> NSMenuItem *foo = (id <NSMenuItem>)[barMenu itemAtIndex:baz];
> Gives the same warning. Requiring the typecast when depreciating
> the protocol seems strange to begin with. What am I missing here?
[NSMenu itemAtIndex:] is declared as
- (id <NSMenuItem>)itemAtIndex:(int)index;
in both the 10.3.9 and 10.4u SDKs, so your cast is completely
redundant. Did you mean to write:
NSMenuItem *foo = (NSMenuItem*)[barMenu itemAtIndex:baz];
?
Anyway, like Matt, I get no warnings without the cast.
Are you subclassing NSMenu and changing the return type? That' s a no
no.
DATE : Tue Aug 01 09:35:02 2006
On 31/07/2006, at 13.58, Fredrik Olsson wrote:
> Even typecasting as;
> NSMenuItem *foo = (id <NSMenuItem>)[barMenu itemAtIndex:baz];
> Gives the same warning. Requiring the typecast when depreciating
> the protocol seems strange to begin with. What am I missing here?
[NSMenu itemAtIndex:] is declared as
- (id <NSMenuItem>)itemAtIndex:(int)index;
in both the 10.3.9 and 10.4u SDKs, so your cast is completely
redundant. Did you mean to write:
NSMenuItem *foo = (NSMenuItem*)[barMenu itemAtIndex:baz];
?
Anyway, like Matt, I get no warnings without the cast.
Are you subclassing NSMenu and changing the return type? That' s a no
no.
| Related mails | Author | Date |
|---|---|---|
| Fredrik Olsson | Jul 31, 13:58 | |
| Matt Neuburg | Jul 31, 21:17 | |
| Fredrik Olsson | Aug 1, 08:21 | |
| Jakob Olesen | Aug 1, 09:35 |






Cocoa mail archive

