Bruce Stephens wrote:
"Derek Scherger" <[EMAIL PROTECTED]> writes:
Even if size does have to traverse a list to count the elements one would
expect that traversing an *empty* list should be reasonably quick.
Sure, but presumably the extra cost is traversing a non-empty list to
find that it's not empty. One would hope that an inlined size()
together with a good optimizing compiler might be able to avoid the
cost, but perhaps that's not feasible.
If there is an invalid pointer in the non-empty list, the program can
crash. If the compiler optimizes (i.e. removes) the list traversal, the
program doesn't crash. Thus, the optimization would change the runtime
behavior of the program.
Cheers,
-- Ulf
_______________________________________________
Monotone-devel mailing list
Monotone-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/monotone-devel