[Issue 1543] Incorrect passing of floats to variadic functions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Oct 13 00:16:05 PDT 2007


http://d.puremagic.com/issues/show_bug.cgi?id=1543


mariusmuja at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mariusmuja at gmail.com,
                   |                            |alan at akbkhome.com
            Summary|Error boxing floats         |Incorrect passing of floats
                   |                            |to variadic functions




------- Comment #1 from mariusmuja at gmail.com  2007-10-13 02:16 -------
The error seems to be from the fact that gdc doesn't pass correctly float
arguments to variadic functions. In the following example the function foo_d()
prints the expected value, but the function foo() doesn't.

import std.stdio;

void foo(...)
{   
        writefln(*cast(float*)_argptr);
}

void foo_d( ...)
{   
        writefln(*cast(double*)_argptr);
}

void main()
{
        foo(10.1f);
        foo_d(10.1);
}


-- 



More information about the D.gnu mailing list