Date: Fri, 13 Dec 2002 18:34:28 +0300 From: "Andrey A. Chernov" <ache@nagual.pp.ru> To: Ruslan Ermilov <ru@FreeBSD.ORG> Cc: bwk@bell-labs.com, obrien@FreeBSD.ORG, current@FreeBSD.ORG Subject: Re: New AWK bug with collating Message-ID: <20021213153428.GA33916@nagual.pp.ru> In-Reply-To: <20021213150942.GE86638@sunbay.com> References: <20021213122654.GA32014@nagual.pp.ru> <20021213123240.GC86638@sunbay.com> <20021213134106.GA32832@nagual.pp.ru> <20021213150942.GE86638@sunbay.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--opJtzjQTFsWo+cga Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Dec 13, 2002 at 17:09:42 +0200, Ruslan Ermilov wrote: > :=20 > : * Integer types `unsigned short' and `unsigned char' promote to > : `unsigned int'. >=20 > With -traditional, the code I quoted still produces -1. Probably because of machine-specific overflow handling or printf overflow. Use this safe example instead (with -traditional): main() { long long l; unsigned char a =3D 1; unsigned char b =3D 2; l =3D a - b; printf("%04x %04x\n", (int)((l >> 32) & 0xffff), (int)(l & 0xffff)); l =3D -1; printf("%04x %04x\n", (int)((l >> 32) & 0xffff), (int)(l & 0xffff)); } > In any case, this section doesn't apply to this case because > no conversion described in section 6.10 is ever done here, > since both operands are of the same type, "unsigned char". No, any char type converted to int (or to unsigned int with -traditional)= =20 prior to any operation with it. --=20 Andrey A. Chernov http://ache.pp.ru/ --opJtzjQTFsWo+cga Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.0 (FreeBSD) iQCVAwUBPfn+BOJgpPLZnQjrAQFwOQP/Z7dqW1Cha7EW1QNO3aBBd1n1u3BMDrh0 0BLeYDWuod7e+XvZqTKnuJfyIShAVSAG1ept64Kmyj5KxdaCzFaXzBoPFx/R9edk 50HvrZ6VgQGydy6UGvRSTElsoNrnvg2+fZg+4uVSEnTUHqKaPpzhGvKA3tlLhBXp HZk+eeg49zI= =LTcP -----END PGP SIGNATURE----- --opJtzjQTFsWo+cga-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021213153428.GA33916>