From owner-freebsd-hackers@FreeBSD.ORG Tue Feb 19 13:20:55 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D6515281 for ; Tue, 19 Feb 2013 13:20:55 +0000 (UTC) (envelope-from borjam@sarenet.es) Received: from proxypop03b.sare.net (proxypop03b.sare.net [194.30.0.251]) by mx1.freebsd.org (Postfix) with ESMTP id 93928CC3 for ; Tue, 19 Feb 2013 13:20:55 +0000 (UTC) Received: from [172.16.2.2] (izaro.sarenet.es [192.148.167.11]) by proxypop03.sare.net (Postfix) with ESMTPSA id 86FCE9DD70F for ; Tue, 19 Feb 2013 14:11:42 +0100 (CET) From: Borja Marcos Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: Stupid question about integer sizes Date: Tue, 19 Feb 2013 14:11:39 +0100 Message-Id: <77B93E04-9254-4EF1-8BDB-ED9214CEC2BC@sarenet.es> To: freebsd-hackers@freebsd.org Mime-Version: 1.0 (Apple Message framework v1085) X-Mailer: Apple Mail (2.1085) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2013 13:20:55 -0000 Hello, I'm really sorry if this is a stupid question, but as far as I know, = u_int64_t defined in /usr/include/sys/types.h should *always* be a 64 bit unsigned integer, right?=20 Seems there's a bug (or I need more and stronger coffee). Compiling a = program on a 64 bit system with -m32 gets the 64 bit integer types = wrong. % cat tachin.c=20 #include #include main() { printf("sizeof uint64_t =3D %d\n", sizeof(uint64_t)); printf("sizeof u_int64_t =3D %d\n", sizeof(u_int64_t)); } uname -a FreeBSD splunk 9.1-RELEASE FreeBSD 9.1-RELEASE #14: Wed Jan 23 17:24:05 = CET 2013 root@splunk:/usr/obj/usr/src/sys/SPLUNK amd64 % gcc -o tachin tachin.c % ./tachin sizeof uint64_t =3D 8 sizeof u_int64_t =3D 8 % ./tachin sizeof uint64_t =3D 4 <=3D=3D=3D=3D=3D=3D=3D = WRONG!! sizeof u_int64_t =3D 4 <=3D=3D=3D=3D=3D=3D=3D WRONG!! The same happens with clang. % clang -m32 -o tachin tachin.c tachin.c:5:1: warning: type specifier missing, defaults to 'int' = [-Wimplicit-int] main() ^~~~ 1 warning generated. % ./tachin sizeof uint64_t =3D 4 <=3D=3D=3D=3D=3D=3D=3D WRONG!! sizeof u_int64_t =3D 4 <=3D=3D=3D=3D=3D=3D=3D WRONG!! if I do the same on a i386 system (8.2-RELEASE, but it should be = irrelevant) the u_int64 types have the correct size. %gcc -o tachin tachin.c %./tachin sizeof uint64_t =3D 8 sizeof u_int64_t =3D 8 Am I missing anything? Seems like a too stupid problem to be a real bug. = Sorry if I am wrong. Borja.