On Jun 29, 2009, at 11:00 PM, Chris Lattner wrote:
>>
>> + for (CXXRecordDecl::base_class_iterator Base = ClassDecl-
>>> bases_begin();
>> + Base != ClassDecl->bases_end(); ++Base) {
>
> You've been learning from Doug very well I see :). The problem with
> this loop is that it evaluates ClassDecl->bases_end() every time
> through the loop. In cases where the end iterator isn't changing (the
> container isn't being mutated by the loop), it is better to compute it
> once and refer to the pre-computed value.
Since this is a common issue that a lot of people run into, I added it
with some more explanation here:
http://llvm.org/docs/CodingStandards.html#ll_end
-Chris
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits