For example, assuming a string s
is this:
for(int x = 0; x < s.length(); x++)
better than this?:
int length
It depends on the inlining and optimization abilities of the compiler. Generally, the second variant will most likely be faster (better: it will be either faster or as fast as the first snippet, but almost never slower).
However, in most cases it doesn't matter, so people tend to prefer the first variant for its shortness.