From kde-devel Fri Mar 20 05:35:39 1998 From: "Russ Steffen" Date: Fri, 20 Mar 1998 05:35:39 +0000 To: kde-devel Subject: Re: 32 bit (un)signed int on every system? X-MARC-Message: https://marc.info/?l=kde-devel&m=89037202909023 On 20-Mar-98, Christian Esken wrote: > On Thu, 19 Mar 1998 Burkhard Lehner wrote: [snip] > >long / unsigned long : seems to be 64 bit on DEC alpha > >int / unsigned int : can be 16 bit on some systems > > Be assured on every proper *nix system sizeof(int)=4 Umm, no. The only int size guarantee you get in C/C++ is: sizeof( [un]signed char ) <= sizeof( [un]signed short ) <= sizeof( [un]signed int ) <= sizeof( [un]signed long ) ( <= sizeof( [un]signed long long* ) when supported ) These are the only assumptions you can make and still keep your code portable. If you really need an int of a particular size, you should use an autoconf macro or the like to make a header file that typedefs the right native int. BTW, there is *no* guarantee that the pointer type will be size compatable with any integer type. Russ -- ---------------------------------- Russ Steffen rsteffen@ia.net