Puzzle on unsigned promotions
Jeffrey E. F. Friedl
jeff at unh.UUCP
Mon Jul 4 14:04:31 AEST 1988
In article <12291 at mimsy.UUCP>, chris at mimsy.UUCP (Chris Torek) writes:
> In article <565 at unh.UUCP> I wrote:
> >... no where in K&R-I can I find where it specifically
> >stipulates that the conversion from unsigned short to a larger unsigned
> >int is done by zero padding and not sign (sign with an unsigned?) extending.
> >... The main problem is K&R's use of terms and fonts.
>
> No, actually, the main problem is that K&R C has only one unsigned
> type, namely unsigned int. Unsigned short, unsigned char, and unsigned
> long do not exist in K&R 1st ed.
Ahhhh. I always knew I should try to get a copy of page 193.
Years ago, my... uhh... dog (ya, that's it) ate it and I just sort
of forgot about it.....
Seeing my mistake for blaming K&R ("forgive me, for I have strayed"),
I ask if the answer to the original poster (friedl at vsi) about what
is "correct" with "unsigned short", etc, is to say
"whatever the compiler writer wanted to do, because it's not
standard C anyway"
(where "standard" refers to K&R-I, not what X3J11 is doing)?
Perhaps the best thing to say about "unsigned short" is
"don't do it" (ANSI C coming our way not withstanding)?
*jeff*
-------------------------------------------------------------------------------
Jeffrey Eric Francis Friedl, Box 2146 Babcock House, Durham New Hampshire 03824
..!{uunet,decvax}!unh!jeff BITNET%"j_friedl at unhh" ..!ucbvax!kentvax!jfriedl
More information about the Comp.lang.c
mailing list