home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.windows.x
- Path: sparky!uunet!utcsri!newsflash.concordia.ca!sifon!thunder.mcrcim.mcgill.edu!mouse
- From: mouse@thunder.mcrcim.mcgill.edu (der Mouse)
- Subject: Re: sizeof(int) == ?
- Message-ID: <1992Nov13.180102.18200@thunder.mcrcim.mcgill.edu>
- Organization: McGill Research Centre for Intelligent Machines
- References: <1992Nov11.124252.4372@spcvxb.spc.edu> <1992Nov12.083615.5375@ericsson.se>
- Date: Fri, 13 Nov 92 18:01:02 GMT
- Lines: 31
-
- In article <1992Nov12.083615.5375@ericsson.se>, etxmesa@eos.ericsson.se (Michael Salmon) writes:
- > In article <1992Nov11.124252.4372@spcvxb.spc.edu>, 4carroll_j@spcvxb.spc.edu writes:
-
- >> I have what I believe to be a very basic question about the
- >> X-Windows distribution source code. Does int always mean a 32-bit
- >> integer? [...]
-
- > There are no rules about the lengths of integers except:
- > sizeof(long) >= sigeof(int)
- > and
- > sizeof(int) >= sizeof(short)
-
- Not quite. It's also guaranteed that sizeof(short) >= sizeof(char),
- that unsigned types are the same size as their signed variants (and
- have the same representation for the values that both can take on), and
- that char is at least 8 bits, short at least 16, and long at least 32.
- (Note that the minimum sizes in bits do not place any restrictions on
- the results of sizeof(). It would be entirely legal - though perhaps
- stupid - to build an implementation that used 32-bit values as its
- quanta and made char, short, int, and long all 32 bits wide, thus
- making sizeof(short)==sizeof(int)==sizeof(long)==1.)
-
- Of course, all that is strictly ANSI. Pre-ANSI, there was no guarantee.
-
- As for the original question, X probably assumes int's at least 32 bits
- and may assume it's exactly 32.
-
- der Mouse
-
- mouse@larry.mcrcim.mcgill.edu
-