From owner-freebsd-questions Sun Nov 12 13: 2:53 2000 Delivered-To: freebsd-questions@freebsd.org Received: from relay2.inwind.it (relay2.inwind.it [212.141.53.73]) by hub.freebsd.org (Postfix) with ESMTP id 050E837B479 for ; Sun, 12 Nov 2000 13:02:50 -0800 (PST) Received: from bartequi.ottodomain.org (62.98.162.127) by relay2.inwind.it (5.1.046) id 3A01ADFF0031B50B for freebsd-questions@FreeBSD.ORG; Sun, 12 Nov 2000 22:02:48 +0100 From: Salvo Bartolotta Date: Sun, 12 Nov 2000 21:03:32 GMT Message-ID: <20001112.21033200@bartequi.ottodomain.org> Subject: OT: curious (??) integer types behavio(u)r... To: freebsd-questions@FreeBSD.ORG X-Mailer: SuperCalifragilis X-Priority: 3 (Normal) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG [ not sure whether/where to send this dumb remark ] Dear FreeBSD'ers, The following simple (test) program seems to behave anomalously on my FreeBSD 4.2-BETA (sources as of this morning) PIII system.
/* A simple test program */ #include main() { char c1 =3D -128; char c2 =3D 127; unsigned char c =3D 255; short int si1 =3D -32768; short int si2 =3D 32767; unsigned short int si =3D 65535; int d1 =3D -2147483648; int d2 =3D 2147483647; unsigned int d =3D 4294967295; unsigned long int l =3D 4294967295; /* redundant */ printf("%d %d %d %d %d %d %d %d %d %ld\n", c1, c2, c, si1, si2, si, d1, d2, d, l); }
>=3D=3D=3D=3D> cc -o mytest mytest.c mytest.c: In function `main': mytest.c:15: warning: decimal constant is so large that it is unsigned mytest.c:17: warning: decimal constant is so large that it is unsigned mytest.c:18: warning: decimal constant is so large that it is unsigned >=3D=3D=3D=3D> ./mytest -128 127 255 -32768 32767 65535 -2147483648 2147483647 -1 -1 (?) ^^^^^^ To sum up: 1) cc complains about line 15, but the limit is correctly displayed by the program (!); 2) cc complains about lines 17 and 18; the limits are INcorrectly displayed. I am probably missing something very trivial here. TIA for any enlightenment, Salvo To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message