[comp.std.c] passing floats to foo

kdb@chinet.chi.il.us (Karl Botts) (08/06/89)

Is there any reasonable way pass a single-precision float to a function
taking a variable number of arguments?  The standard says something to
the effect of: "In the absence of a function prototype, floats will be
widened to double." I guess I am willing to stipulate that ",..." is
equivalent to
"in the absence of a prototype."  Still, it seems a shame that the float
gets widened (by no means a cheap operation) only to have me force it
back to float in the first line of the function. 

I suppose I could do something ugly with a union, or something like
that...

chris@mimsy.UUCP (Chris Torek) (08/07/89)

In article <9183@chinet.chi.il.us> kdb@chinet.chi.il.us (Karl Botts) writes:
>Is there any reasonable way pass a single-precision float to a function
>taking a variable number of arguments?

Pass its address.  This is rather ugly, but completely portable.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris@mimsy.umd.edu	Path:	uunet!mimsy!chris