On Sat, 17 Sep 2005 10:33:01 -0400 Synthetic Cartoonz <synthetoonz@bellsouth.net> wrote:
On Saturday 17 September 2005 09:00, Anders Johansson wrote:
On Friday 16 September 2005 20:19, Jerry Feldman wrote:
For instance the following code fragment is standards compliant but non-portable: long n; int i = -2; unsigned k = 1; n = i + k;
sign extensions in promotions is something they really should have standardised by now. They haven't even standardised on the binary representation of negative numbers, [...]
Should a high level language be dictating to CPU manufacturers how processors must internally represents values? Promotions and sign extensions are highly standardized by both the C89 and C99 standards. In this case, promotions work exactly as specified by c99. (I've verified this because I used this in a paper).
Languages dictate BEHAVIOR, not CPU or OS work. In this case, you will get a different result on 32-bits and 64-bits. -- 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