Something I've always wondered is at what point one of the two methods becomes more efficient: casting a value whenever needed, or casting that value once to a new variable.
I.e., I need the double value of of an int a few times, should I cast it once (double x_f = (double)x or cast it where needed (even if it's not going to change) ((double)x). I think for ints and doubles, the answer is to cast it to a new variable and use the variable, but what if the two different cases are likely the same, i.e. size_t and unsigned int? What would you do?
I know this is a trivial question, but I like to learn the most efficient way of doing things.