[kaffe] HAVE_move_float_const
Gerlando Falauto
iurly at writeme.com
Mon Jun 30 12:01:02 PDT 2003
> > Don't have that manual at hand, but I think that very much depends on the
> > compiler and/or the runtime architecture. I can assure you my (old, ugly,
> > buggy, horrible, non-standard, fp-less, whatever) compiler and
>
> You could consider using a better compiler ;)
You wanna write one? ;-) Be my guest!
Seriously, it's a sort of top-secret platform, and this compiler is the
best I could ever get.
> > architecture do not make such a conversion. If a parameter is a float,
> > it's passed in one register (or memory slot), if it's a double, it takes
> > two registers/slots.
>
> This really depends on what version of the C the compiler implements. In K&R C
> (i.e. pre-ANSI), float function parameters are always promoted to double. In
> post-ANSI C (i.e. C89, C99) float function parameters are only promoted to
> double, if the function declaration is written in K&R style.
>
> Confusing? Sure it is, so just use double and you're on the safe side ;)
Nope, it's perfectly clear but still I don't get your point. If you wanna
be safe, shouldn't you just be CONSISTENT? Declare it as a float, and let
the compiler decide what casts are appropriate. At this level, so long as
I get what was meant to be passed (which is a *float*), I shouldn't really
care what the compiler does. The point here is, I want a float constant
(which is 32-bit wide) exactly as it was written in the classfile, so I
can move it to a register (as a 32-bit chunk). If the compiler wants to
promote it as an internal optimization, that is none of my business!
If I get it as a double, I have to cast it back to a float. Apart from
the waste of time, is that guaranteed to be non-destructive?
later,
Gerlando
More information about the kaffe
mailing list