long conversion of short expression.

Doug Gwyn gwyn at smoke.BRL.MIL
Sun Jul 30 20:49:14 AEST 1989


In article <9092 at chinet.chi.il.us> pdg at chinet.chi.il.us (Paul Guthrie) writes:
>In the following code segment, the two shorts multiplied together
>exceed the size of a short, but the question is, is the result
>of the multiplication really a short to be converted to a
>long, or a long already?

Arithmetic operators that have the same arithmetic type for their operands
always produce the same type for the result.  If you want the result to be
a different type, convert at least one of the operands via a cast before
applying the arithmetic operator.



More information about the Comp.lang.c mailing list