Re: start in NSOperation
Re: start in NSOperation
- Subject: Re: start in NSOperation
- From: glenn andreas <email@hidden>
- Date: Mon, 06 Jan 2014 12:44:17 -0600
Turn on -Woverriding-method-mismatch
$ xcrun clang --version
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
$ cat return.m
#import <Foundation/Foundation.h>
@interface ClassA :NSObject
- (void) foo;
@end
@interface ClassB : ClassA
- (int) foo;
@end
@interface ClassC : ClassB
- (NSRange) foo;
@end
$ xcrun clang -Woverriding-method-mismatch -fsyntax-only return.m
return.m:8:1: warning: conflicting return type in declaration of 'foo': 'void' vs 'int'
[-Woverriding-method-mismatch]
- (int) foo;
^ ~~~
return.m:4:1: note: previous declaration is here
- (void) foo;
^ ~~~~
return.m:12:1: warning: conflicting return type in declaration of 'foo': 'int' vs 'NSRange'
(aka 'struct _NSRange') [-Woverriding-method-mismatch]
- (NSRange) foo;
^ ~~~~~~~
return.m:8:1: note: previous declaration is here
- (int) foo;
^ ~~~
2 warnings generated.
On Jan 6, 2014, at 10:52 AM, Kyle Sluder <email@hidden> wrote:
> On Mon, Jan 6, 2014, at 02:39 AM, Roland King wrote:
>> since the return type isn't part of the
>> signature of a method, overriding it with start which takes no parameters
>> and returns an integer is allowed
>
> I found this unbelievable, but then I wrote a test and confirmed it is
> true.
>
> That's insane. What if the overridde's return type causes it to use a
> different calling convention? I'm gonna file a compiler bug.
>
> --Kyle Sluder
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden