Re: How to avoid warning?
Re: How to avoid warning?
- Subject: Re: How to avoid warning?
- From: John McCall <email@hidden>
- Date: Tue, 22 Jan 2013 10:45:57 -0800
On Jan 22, 2013, at 9:23 AM, Dave <email@hidden> wrote:
> That's wont help because myClass is a variable created from a String.
But it will help, because Quincey's suggestion is not contingent on the type of the object that you send the message to. The compiler is merely asking that you have declared a method with that selector *somewhere* in this translation unit so that it knows (or at least has a really good guess) about the formal signature of the method you're calling.
This is because (1) we would like to do at least some minimal type-checking on the method call, like whether 'self' can be passed as that argument, and (2) calling conventions can differ depending on the formal signature of the method, and we need to get that right for the call to succeed.
You could argue that in the specific case of an init method, we should guess about what this signature is; but (1) there really are exceptions to the conventions, even with init methods, and (2) there's really no good reason for you to not have at least one declaration somewhere in the translation unit.
John.
_______________________________________________
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