Hi, On Wed, Aug 11, 2010 at 5:54 PM, peter green wrote: > Wouter van Ooijen wrote: >> =A0> Afaict C varargs require the caller to do the removal >> >>> because only the caller knows for sure how many parameters have been >>> passed and due to the retarted way C handles prototypes you can't have = a >>> different interface for varargs and non-varargs functions. >>> >> >> Maybe in super-ancient C, but with function prototypes... >> > But when the compiler builds the function it doesn't know whether the > caller will be using function prototypes or not. The C99 standard explicitly requires that you have the prototype in the varargs case, see 6.5.2.2 paragraph 6: =A0If the expression that denotes the called function has a type that does =A0not include a prototype, the integer promotions are performed on each =A0argument, and arguments that have type float are promoted to double. =A0These are called the default argument promotions. If the number of =A0arguments does not agree with the number of parameters, the behavior is =A0undefined. If the function is defined with a type that includes a =A0prototype, and either the prototype ends with an ellipsis (, ...) or the =A0types of the arguments after promotion are not compatible with the types =A0of the parameters, the behavior is undefined. So, if you try to call a vararg function without providing the prototype, the result is undefined because you cannot define a vararg function without using a prototype, see 6.9.1 p8. Daniel. --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .