NightStrike wrote: > By using 'max' instead of v.size(), I am eliminating a function call > from every iteration of the for loop. If the loop is iterated a large > number of times, this could have an advantage. However, is it all the > same when you are optimizing? Does g++ remove the need for the second > method? The compiler can hoist the condition out of the loop, but only if it can determine that v is not modified inside the loop. It might know this if it can determine that all function calls inside the loop are pure, or if v is a local auto variable that's not had its address taken. There could be other ways it can prove this, I don't know. It's hard to really say much in the abstract about what the compiler might or might not do, because so much depends on the details of the code and the information that the compiler has on hand. A testcase is much more valuable because you can look at the -S output and see for sure. Brian