Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Usefulness of -Wstrict-selector-match



Jonathan,

Thanks for your reply.  The cast would of course work, but seems icky
since the variable is not an NSArray, it could be an NSSet,
NSDictionary, etc.  The snippit I gave is of course an example, but the
real code is in an NSValueTransformer subclass' "-(id)transformedValue:
(id)value" method, hence my use of 'id'.

I guess my real question is: are people using -Wstrict-selector-match or
do most of you run into annoying warnings like below?

Cheers,

Sean


On 4/17/08 6:20 PM, Jonathan deWerd said:

>Cast the array to an NSArray*. Better, define it as one in the first
>place. Use id as little as possible.
>
>On Apr 17, 2008, at 12:26 PM, Sean McBride wrote:
>
>> Hi all,
>>
>> Given:
>>
>> -------
>> #import <Cocoa/Cocoa.h>
>>
>> int main (void)
>> {
>> 	id array_or_set = nil;
>> 	NSUInteger x = [array_or_set count];
>> 	(void)x;
>> 	
>> 	return 0;
>> }
>> -------
>>
>> and compiling like so:
>>
>> $ gcc -Wstrict-selector-match -framework Cocoa ~/Desktop/
>> count_warning.m
>>
>> I get:
>>
>> warning: multiple methods named '-count' found
>> /System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:15:
>> warning: using '-(NSUInteger)count'
>> /System/Library/Frameworks/QuartzCore.framework/Headers/CIVector.h:59:
>> warning: also found '-(size_t)count'
>>
>> How do others deal with this?  I find -Wstrict-selector-match often
>> useful, but cases like these are problematic.
>>
>> Cheers,
>>
>> --
>> ____________________________________________________________
>> Sean McBride, B. Eng                 email@hidden
>> 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      (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/objc-language/email@hidden
>>
>> This email sent to email@hidden
>
> _______________________________________________
>Do not post admin requests to the list. They will be ignored.
>Objc-language mailing list      (email@hidden)
>Help/Unsubscribe/Update your Subscription:
>http://lists.apple.com/mailman/options/objc-language/sean%40rogue-
research.com
>
>This email sent to email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/objc-language/email@hidden

This email sent to email@hidden

References: 
 >Usefulness of -Wstrict-selector-match (From: "Sean McBride" <email@hidden>)
 >Re: Usefulness of -Wstrict-selector-match (From: Jonathan deWerd <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.