Type conversion within arithmetic expressions. What does ANSI say ?
Jeffrey T. Hutzelman
jh4o+ at andrew.cmu.edu
Fri Oct 5 08:37:01 AEST 1990
The ANSI standard does not guarantee the sizes of unsigned char and
unsigned short int; only that sizeof(char)<=sizeof(short). If you
want to be sure it works, try z=(unsigned short)x * (unsigned short)y
(you may need parens; I'm not familiar with the precedence rules
regarding type casting, but I think it is higher that multiply).
-----------------
Jeffrey Hutzelman
America Online: JeffreyH11
Internet/BITNET:jh4o+ at andrew.cmu.edu, jhutz at drycas.club.cc.cmu.edu
>> Apple // Forever!!! <<
More information about the Comp.lang.c
mailing list