This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Promoting floats to doubles?
On Mon, 2004-05-03 at 18:15, Kean Johnston wrote:
> It turns out I have a real problem on my hands. The OSR5 ABI
> dictates that floats are always promoted to doubles.
You could look at gcc versions from a few versions ago, find the K&R C
support that did this, and re-add it suitably configured so it can be
enabled for your target only.
You could look at the current PROMOTE_FUNCTION_ARG/PROMOTE_PROTOTYPES
stuff and extend it so that it works for float->double conversions.
You can use fixinc to fix the prototypes.
The fixinc solution has the flaw that code with prototypes that use
float won't be portable between the SCO compiler and GCC. You can fix
the system header prototypes, but you can't fix the prototypes in all
applications and libraries.
The first two solutions have the flaw that they violate the intent of
ISO C, though I don't think they violate the letter of the standard.
Converting float to double won't change the value. It just makes the
code less efficient, as you will have an unnecessary float to double
conversion in the caller, and an unnecessary double to float conversion
in the callee. Any well written program should not be affected by these
unnecessary conversions.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com