I made the mistake of assuming that in C++ parameters to functions are evaluated left to right, but actually the order is undefined by the C++ code standard and thus it is implementation specific. This was messing me up because they were going from right to left and not left to right as I had assumed.
EDIT: oh, uh, I guess C++ is a bit much. Does it count as a mistake that I was too in-depth?