home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!ames!saimiri.primate.wisc.edu!zaphod.mps.ohio-state.edu!rphroy!ilium!nigel.msen.com!heifetz!dgsi!ejd
- From: ejd@cimage.com (Ed Driscoll)
- Newsgroups: comp.lang.c
- Subject: Re: Typedefing builtin... thanks.
- Message-ID: <1992Nov20.164732.8121@cimage.com>
- Date: 20 Nov 92 16:47:32 GMT
- References: <1992Nov9.150414.10221@odin.diku.dk> <1992Nov17.235519.24646@pure.com>
- Organization: Cimage Corp., Ann Arbor, MI
- Lines: 35
-
- In article <1992Nov17.235519.24646@pure.com> rpeck@pure.com (Ray Peck) writes:
- >
- >The only problem with this is a WORD is not a portable concept (i.e.,
- >people in 68k's call 16 bits a word, while people on Real Machines ;-)
- >call 32 bits a word. All modern machines use 32b and up.
- >
- >
- >For this reason, I prefer types int8, int16, int32, or (better) u1b,
- >u2b, u4b, (unsigned) and s1b, s2b, s4b (signed).
- >
-
- I've been thinking about doing it that way myself, but it seems to me that
- you would want two variants of each size: one for when you need EXACLTY
- that number of bits, and one when you just need AT LEAST that number of
- bits. The former type would be used where the exact size matters (say,
- something you're reading from a file, or something used for bit flags).
- The latter type would be used for things like loop counters where you
- wanted to use the most efficient size that is sufficient. For instance,
- the "at least 8 bit" type might be defined as a 32-bit int on a machine
- that had that as it's "natural" word size.
-
- Opinions on that idea?
-
- >--
- >Ray Peck rpeck@pure.com
- >Pure Software 415-903-5100
- >
-
- The guys who wrote Purify, right? Awesome product!
-
-
- --
- Ed Driscoll
- Cimage Corp.
- ejd@cimage.com
-