[comp.arch] Type Conversions

sedwards@esunix.UUCP (Scott Edwards) (03/18/88)

From article <2035@ho95e.ATT.COM>, by wcs@ho95e.ATT.COM (Bill.Stewart.<ho95c>):
> 	type-conversions float->double, char->int, short->int.
> On machines with signed characters, this does a sign-extend; on machines with
> unsigned it doesn't.  I assume unsigned-chars on a signed-char machine
> get promoted to unsigned for passing.

Since you brought this up, I've recently discovered that in the ANSI draft
that prototypes override the implicit type conversions, as in float will
not be promoted to double if the prototype declares it to be float.  Does
this mean that char would not be promoted to int?  If so what would that
to machines that have alignment restrictions and parameters are passed on
the stack?  Just curious.

schooler@oak.bbn.com (Richard Schooler) (03/22/88)

In article <753@esunix.UUCP>, sedwards@esunix (Scott Edwards) writes:
>Since you brought this up, I've recently discovered that in the ANSI draft
>that prototypes override the implicit type conversions, as in float will
>not be promoted to double if the prototype declares it to be float.  Does
>this mean that char would not be promoted to int?  If so what would that
>to machines that have alignment restrictions and parameters are passed on
>the stack?  Just curious.

Many machines now have 32-bit wide stacks.  Pushing an eight-bit
quantity is possible, but advances the stack pointer by four (on a
byte-addressable machine).  The eight-bit quantity isn't promoted, but
merely padded.
		-- Richard Schooler