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



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

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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>)



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.