http://h21007.www2.hp.com/dspp/files/unprotected/32bitto64bit_whitepaper. pdf
Thanks for whitepaper, exactly what I was looking for. Initially I thought that the conversion rules are implementation dependendent. The rules in the standard are very much implementation independent, but
On Wednesday 29 March 2006 2:35 am, Verdi March wrote:
there are some cases that are not covered by the standard, but your
examples were very clear.
The issues on sign extension can be counter-intuitive.
long long ll_i;
int i;
unsigned int j;
ll_i = i + j;
In this case, no sign extension because the expression, (i + j) is an
unsigned 32-bit expression. The unsigned 32-bit expresssion is widened
after the arithmetic.
ii_i = (long long)i + j;
In this case, i is widened with sign extension before the addition.
j is widened with no sign extension before the addition.
Additionally, the white paper is over a year old, and I may want to update
it at the end of my current project, please feel free to email me any
suggestions for improvement.
--
Jerry Feldman