>The canonical example is +[NSApplication sharedApplication]. Returning
>NSApplication means you always have to cast to your real NSApplication
>subclass, which is little more than syntactic noise. Returning id means
>you don't need the cast, but it also means you get no type checking and
>too many code completion results. Returning __kindof NSApplication is a
>good compromise.
Interesting example. My app has dozens of new warnings in Xcode 7 due to the above. Hopefully this is not yet working as intended. Consider:
clang -Weverything -fsyntax-only ~/test.m
--------------
#import <AppKit/AppKit.h>
int main(void)
{
(void)[NSApp delegate];
return 0;
}
--------------
it gives:
/Users/sean/test.m:5:8: warning: multiple methods named 'delegate' found [-Wstrict-selector-match]
(void)[NSApp delegate];
^~~~~~~~~~~~~~~~
Same if you use "[NSApplication sharedApplication]" instead of "NSApp".
(See rdar://21306753 which is really just rdar://6845498 still unfixed.)
Cheers,
--
____________________________________________________________
Sean McBride, B. Eng sean@rogue-research.com
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list (Objc-language@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/objc-language/anirudha.k.cpp1%40blogger.com
This email sent to anirudha.k.cpp1@blogger.com
No comments:
Post a Comment