As we have seen in another post, functions that receive a variable argument list but which are all the same type are better replaced by a function and variadic macro. P99 has easy means to transform an argument list
x0, x2, .., xN into two parameters the first being just the length of the list, here
N+1 and an array that has the values. These types of functions can usually be much better optimized in place by modern compilers.
va_arg functions should first of all restricted to the case that the function may receive incompatible types as its argument (such as floating point and integers). If used for that the default argument promotion rules may be really harmful.
Continue reading “Avoid writing