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 <gaf@blu.org> Boston Linux and Unix user group http://www.blu.org PGP key id:C5061EA9 PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9