Conversions/casts one more time

Stuart D. Gathman stuart at bms-at.UUCP
Mon Dec 15 08:15:45 AEST 1986


In article <820 at mtund.UUCP>, adam at mtund.UUCP (Adam V. Reed) writes:

> > 	printf("\tc = %x, (char)uc = %x, (char)ucf() = %x\n",
> > 	  c, (char)uc, (char)ucf());

> Ugh. %x expects an int, so the result of feeding it a char is,
> *and ought to be*, UNDEFINED.

Except that function arguments of short and char are automatically
converted to type int except possibly when a function prototype is
given and it is not a variable argument.  (Whew!)  All three arguments
are (or should) be implicitly cast to int.  In this case, the compiler
thought that the last char was unsigned presumably because of the
function declaration.
-- 
Stuart D. Gathman	<..!seismo!dgis!bms-at!stuart>



More information about the Comp.lang.c mailing list