From owner-freebsd-hackers Mon Jan 12 15:50:27 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.7/8.8.7) id PAA21853 for hackers-outgoing; Mon, 12 Jan 1998 15:50:27 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from cheops.anu.edu.au (cheops.anu.edu.au [150.203.76.24]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id PAA21649 for ; Mon, 12 Jan 1998 15:49:56 -0800 (PST) (envelope-from avalon@coombs.anu.edu.au) Message-Id: <199801122349.PAA21649@hub.freebsd.org> Received: by cheops.anu.edu.au (1.37.109.16/16.2) id AA189008914; Tue, 13 Jan 1998 10:48:34 +1100 From: Darren Reed Subject: Re: New typedefs in sys/types.h To: tlambert@primenet.com (Terry Lambert) Date: Tue, 13 Jan 1998 10:48:34 +1100 (EDT) Cc: brian@awfulhak.org, freebsd-hackers@FreeBSD.ORG In-Reply-To: <199801121944.MAA28476@usr04.primenet.com> from "Terry Lambert" at Jan 12, 98 07:44:29 pm X-Mailer: ELM [version 2.4 PL23] Content-Type: text Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk In some mail from Terry Lambert, sie said: > > > With the upcoming Alpha stuff, it looks like there are going to be > > some problems..... I'm assuming that a `long' is gonna be 64 bits > > rather than 32. > > I don't know about this. > > Clearly, the u_long should be replaced by u_int32_t; that's a given. Yup. > But if a long is 64 bits, then what's 32 bits... a short? And if a > short is 32 bits, what's 16 bits? > > Technically, long should be 64 bits because sizeof(int) is <= sizeof(long); > but just as technically, a 64 bit int meets the "register size test" > and the "single bus cycle test" for "int-ness" (the same test that > *should* have made compiler writers use 16 bit int's on 68000/68010 > chips). > > The problem is that C fails to have sized types. > > I'm not sure if the NetBSD/Alpha compiler uses int/long = 64 bits, > or uses "long long" (I'm not a home, so it's hard to check; I always > used sized types instead of int or long or long long). i believe i goes like... long = 64 bits int = 32 bits short = 16 bits char = 8 bits and of course... void * = 64 bits Of course, wherever size matters, you should be using u_int32_t or u_int16_t or u_int64_t.