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

Fariborz Jahanian fjahanian at apple.com
Wed Sep 8 11:50:51 PDT 2010


On Sep 8, 2010, at 11:05 AM, Ted Kremenek wrote:

> 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.
Problem with this is that this is very common form of assignments in  
objc and checker will get very noisy.

- Fariborz

>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev





More information about the cfe-dev mailing list