home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / windows / x / 19128 < prev    next >
Encoding:
Text File  |  1992-11-14  |  1.7 KB  |  41 lines

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