[cfe-dev] Objective-C really strong type checking

Ted Kremenek kremenek at apple.com
Wed Sep 8 11:05:22 PDT 2010


On Sep 8, 2010, at 2:01 AM, Marcin Świderski wrote:

> Hi All
> 
> Is there a check implemented in Clang Checker (maybe not released for XCode yet) that would find errors like in example:
> 
> @interface SomeClass : NSObject {
>   NSMutableDictionary *_someObjects;
> }
> @end
> 
> @implementation SomeClass
> - (id)init {
>   if ((self = [super init])) {
>     _someObject = [NSMutableArray new];
>   }
>   return self;
> }
> @end
> 
> Methods 'new' or 'init' return object of type 'id' by convention, but as I experienced it myself it can be unsafe.
> 
> Cheers
> Marcin

This isn't implemented, but it would be a great check and would be really easy to do.



More information about the cfe-dev mailing list