On Dec 12, 2006, at 12:07 PM, David Edelsohn wrote:

Dale Johannesen writes:

Dale> It may have been intended to allow the callee to be a K&R- style or
Dale> varargs function, where all float args get promoted to double.
Dale> In particular, printf was often called without being declared in K&R- Dale> era code. This is one way to make that code work in a C90 environment.

        Except that arguments in registers are not promoted and arguments
in registers spilled to the stack for varargs are not promoted. In fact
it makes varargs more complicated.  And it does not really match K&R
promotion rules.

On ppc, floating point regs always contain values in double format, so passing a single value and reading it as double Just Works.

To clarify, I am not defending this, just offering a possible explanation. If I'm right, the whole issue is obsolete and there is currently no good reason to do the promotion.


Reply via email to