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

  1. Newsgroups: comp.windows.x
  2. Path: sparky!uunet!mcsun!sunic!ericom!eos.ericsson.se!etxmesa
  3. From: etxmesa@eos.ericsson.se (Michael Salmon)
  4. Subject: Re: sizeof(int) == ?
  5. Message-ID: <1992Nov12.083615.5375@ericsson.se>
  6. Sender: news@ericsson.se
  7. Nntp-Posting-Host: eos6c02.ericsson.se
  8. Reply-To: etxmesa@eos.ericsson.se (Michael Salmon)
  9. Organization: Ericsson Telecom AB
  10. References:  <1992Nov11.124252.4372@spcvxb.spc.edu>
  11. Date: Thu, 12 Nov 1992 08:36:15 GMT
  12. Lines: 43
  13.  
  14. In article <1992Nov11.124252.4372@spcvxb.spc.edu>, 
  15. 4carroll_j@spcvxb.spc.edu writes:
  16. |> 
  17. |>  Hi,
  18. |>  
  19. |>      I have what I believe to be a very basic question about the X-Windows 
  20. |>  distribution source code. Does int always mean a 32-bit integer?
  21. |>  
  22. |>      I have encountered so many places where this is true, that I am thinking 
  23. |>  about attempting to change all references to an int to a long (I work on a 
  24. |>  machine that assumes int == 16-bits).
  25. |>  
  26. |>      If this assumption (int==32-bits) is not True, are there any rules for 
  27. |>  knowing in advance when an int is required?
  28.  
  29. There are no rules about the lengths of integers except:
  30.  
  31. sizeof(long) >= sigeof(int)
  32.  
  33. and
  34.  
  35. sizeof(int) >= sizeof(short)
  36.  
  37. i.e. a short and a long can be the same size. I don't know of any
  38. machine that has had an int shorter than 16 bits but my experience
  39. isn't that wide. Int seems to be a data size that is easily implemented
  40. and usefully long. As to which you should use, you must decide that
  41. based upon the range of the data that you plan to handle. If you want
  42. something that is portable then use typedefs that can be adapted for
  43. each environment, perhaps with asserts to ensure that the types are
  44. wide enough. Another approach is to use something like enquire that
  45. comes with gcc to automatically generate the typedefs.
  46.  
  47. -- 
  48.  
  49. Michael Salmon
  50.  
  51. #include    <standard.disclaimer>
  52. #include    <witty.saying>
  53. #include    <fancy.pseudo.graphics>
  54.  
  55. Ericsson Telecom AB
  56. Stockholm
  57.