home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.windows.x
- Path: sparky!uunet!mcsun!sunic!ericom!eos.ericsson.se!etxmesa
- From: etxmesa@eos.ericsson.se (Michael Salmon)
- Subject: Re: sizeof(int) == ?
- Message-ID: <1992Nov12.083615.5375@ericsson.se>
- Sender: news@ericsson.se
- Nntp-Posting-Host: eos6c02.ericsson.se
- Reply-To: etxmesa@eos.ericsson.se (Michael Salmon)
- Organization: Ericsson Telecom AB
- References: <1992Nov11.124252.4372@spcvxb.spc.edu>
- Date: Thu, 12 Nov 1992 08:36:15 GMT
- Lines: 43
-
- In article <1992Nov11.124252.4372@spcvxb.spc.edu>,
- 4carroll_j@spcvxb.spc.edu writes:
- |>
- |> Hi,
- |>
- |> 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?
- |>
- |> I have encountered so many places where this is true, that I am thinking
- |> about attempting to change all references to an int to a long (I work on a
- |> machine that assumes int == 16-bits).
- |>
- |> If this assumption (int==32-bits) is not True, are there any rules for
- |> knowing in advance when an int is required?
-
- There are no rules about the lengths of integers except:
-
- sizeof(long) >= sigeof(int)
-
- and
-
- sizeof(int) >= sizeof(short)
-
- i.e. a short and a long can be the same size. I don't know of any
- machine that has had an int shorter than 16 bits but my experience
- isn't that wide. Int seems to be a data size that is easily implemented
- and usefully long. As to which you should use, you must decide that
- based upon the range of the data that you plan to handle. If you want
- something that is portable then use typedefs that can be adapted for
- each environment, perhaps with asserts to ensure that the types are
- wide enough. Another approach is to use something like enquire that
- comes with gcc to automatically generate the typedefs.
-
- --
-
- Michael Salmon
-
- #include <standard.disclaimer>
- #include <witty.saying>
- #include <fancy.pseudo.graphics>
-
- Ericsson Telecom AB
- Stockholm
-