Date: Tue, 13 Jan 1998 10:48:34 +1100 (EDT) From: Darren Reed <avalon@coombs.anu.edu.au> To: tlambert@primenet.com (Terry Lambert) Cc: brian@awfulhak.org, freebsd-hackers@FreeBSD.ORG Subject: Re: New typedefs in sys/types.h Message-ID: <199801122349.PAA21649@hub.freebsd.org> In-Reply-To: <199801121944.MAA28476@usr04.primenet.com> from "Terry Lambert" at Jan 12, 98 07:44:29 pm
next in thread | previous in thread | raw e-mail | index | archive | help
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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199801122349.PAA21649>