Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!know!zaphod.mps.ohio-state.edu!wuarchive!udel!rochester!pt.cs.cmu.edu!o.gp.cs.cmu.edu!andrew.cmu.edu!jh4o+ From: jh4o+@andrew.cmu.edu (Jeffrey T. Hutzelman) Newsgroups: comp.lang.c Subject: Re: Type conversion within arithmetic expressions. What does ANSI say ? Message-ID: Date: 4 Oct 90 22:37:01 GMT References: <6584@castle.ed.ac.uk> Organization: Carnegie Mellon, Pittsburgh, PA Lines: 11 In-Reply-To: <6584@castle.ed.ac.uk> 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+@andrew.cmu.edu, jhutz@drycas.club.cc.cmu.edu >> Apple // Forever!!! <<