Date: Sun, 12 Nov 2000 21:03:32 GMT From: Salvo Bartolotta <bartequi@inwind.it> To: freebsd-questions@FreeBSD.ORG Subject: OT: curious (??) integer types behavio(u)r... Message-ID: <20001112.21033200@bartequi.ottodomain.org>
next in thread | raw e-mail | index | archive | help
[ 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.
<blockquote>
/* A simple test program */
#include <stdio.h>
main()
{
char c1 = -128;
char c2 = 127;
unsigned char c = 255;
short int si1 = -32768;
short int si2 = 32767;
unsigned short int si = 65535;
int d1 = -2147483648;
int d2 = 2147483647;
unsigned int d = 4294967295;
unsigned long int l = 4294967295; /* redundant */
printf("%d %d %d %d %d %d %d %d %d %ld\n", c1, c2, c, si1,
si2, si, d1, d2, d, l);
}
</blockquote>
>====> 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
>====> ./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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001112.21033200>
