On Thu, 14 Oct 2010 13:50:42 -0700, Greg Parker said:

>`[self alloc]` returns `id`, so the compiler has to guess which method
>prototype to use, yours or NSArray's. If it guesses wrong, you'll get
>that warning. Sometimes you'll get crashes or incorrect parameter values
>when the compiler guesses wrong, but in this case the generated code
>happens to work correctly.
>
>I'd recommend changing your method name. -initWithArray: would work,
>matching -[NSArray initWithArray:(NSArray*)array].

There's also the '-Wstrict-selector-match' warning:

"Warn if multiple methods with differing argument and/or return types
are found for a given selector when attempting to send a message using
this selector to a receiver of type "id" or "Class".  When this setting
is disabled, the compiler will omit such warnings if any differences
found are confined to types which share the same size and alignment.
[GCC_WARN_STRICT_SELECTOR_MATCH, -Wstrict-selector-match]"

Alas, the warning is not so useful in practice because Apple's headers
trigger hundreds of such warnings.

--
____________________________________________________________
Sean McBride, B. Eng                 [email protected]
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada


_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to