Re: warning:assignment from distinct Objective-C type
Re: warning:assignment from distinct Objective-C type
- Subject: Re: warning:assignment from distinct Objective-C type
- From: Ken Thomases <email@hidden>
- Date: Wed, 1 Jul 2009 11:34:15 -0500
On Jul 1, 2009, at 11:26 AM, David Blanton wrote:
in .h file
NSMutableArray *m_sources;
[...]
m_sources = [volumes stringsByAppendingPaths:[defaultManager
directoryContentsAtPath:volumes]];
-stringsByAppendingPaths: returns an NSArray*. That is not an
NSMutableArray*. (NSMutableArray is-a NSArray, though, of course.)
By assigning to m_sources, you're "threatening" to invoke mutation
methods on the object. This would be a violation of the type system,
and so the compiler warns you about it.
Regards,
Ken
_______________________________________________
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