Type promotion in ccall arguments
Julian_Seward at muraroa.demon.co.uk
Thu Mar 14 08:47:09 EST 2002
> the native code generator was passing the Float as a C float on the
> stack, but snprintf() expects a double. Half-remembering that C
> specifies that floats should be promoted to doubles in function call
> arguemts, I modified the NCG to do just this. But the C standard
> doesn't say this - it says that floats are promoted to doubles only for
> (a) functions without an ANSI prototype, and
> (b) vararg functions, for args after the "...".
Ha. So that explains why it sort-of worked before, since the
promotion doesn't happen if there is a prototype. Well spotted.
How absolutely horrible. Why do the C people have such a
bizarre set of rules?
More information about the FFI