[cfe-commits] r42412 - in /cfe/trunk: AST/Decl.cpp Parse/ParseObjc.cpp Parse/Parser.cpp Sema/Sema.h Sema/SemaDecl.cpp clang.xcodeproj/project.pbxproj include/clang/AST/Decl.h include/clang/Basic/DiagnosticKinds.def include/clang/Parse/Action.h include/clang/Parse/Parser.h test/Sema/method-undefined-warn-1.m

Chris Lattner clattner at apple.com
Thu Oct 4 15:27:27 PDT 2007

On Oct 4, 2007, at 3:01 PM, Steve Naroff wrote:

>>>> +    if (!Map.count(methods[j]->getSelector())) {
>> Since I am reading the code in context, I can imagine that "count"  
>> is being used as a "lookup" function.
> Hey, I totally agree with you here. Unfortunately "count" is an  
> idiom that comes from the STL.  :(  I assume that it is for  
> generality across multimap and multisets where a key can be in the  
> container more than once.
>> Nevertheless, in isolation, the preceding expression doesn't read  
>> well or make sense (I discussed this with Fariborz when I reviewed  
>> his patch...he said Chris said this was the most efficient:-)
> The getName() expression wouldn't be as efficient?
> My previous comment applied to the Map.count idiom (not getName()).  
> I have no problem with the efficiency of getName()...obviously:-)

Map.count is the most efficient way to determine whether or not a key  
is in the map.  What other option are you thinking?


More information about the cfe-commits mailing list