HELP!! arg-lists in Turbo-C

Lloyd Kremer kremer at cs.odu.edu
Thu Oct 19 01:10:26 AEST 1989


In article <19724 at ut-emx.UUCP> readdm at walt.cc.utexas.edu (David M. Read) writes:

>I noticed that when I use va_arg (va_list, type) with 
>type = float, the result is useless, but using type = double seems
>to resolve the problem.  This indicates that floats are pushed onto
>the stack as type double, no?


Traditionally, yes.  In classic C, floats are promoted to doubles at any
evaluation, including evaluation for the purpose of passing as an argument.

In ANSI C, you can arrange for a passed float to be received as a float
rather than as a double by defining the receiving function as

	void rec_func(float foo)  /* new style definition */
	{
	}

instead of

	void rec_func(foo)        /* old style definition */
	double foo;
	{
	}

-- 
					Lloyd Kremer
					...!uunet!xanth!kremer
					Have terminal...will hack!



More information about the Comp.lang.c mailing list