home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / c / 16890 < prev    next >
Encoding:
Internet Message Format  |  1992-11-20  |  1.7 KB

  1. 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
  2. From: ejd@cimage.com (Ed Driscoll)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Typedefing builtin... thanks.
  5. Message-ID: <1992Nov20.164732.8121@cimage.com>
  6. Date: 20 Nov 92 16:47:32 GMT
  7. References: <1992Nov9.150414.10221@odin.diku.dk> <1992Nov17.235519.24646@pure.com>
  8. Organization: Cimage Corp., Ann Arbor, MI
  9. Lines: 35
  10.  
  11. In article <1992Nov17.235519.24646@pure.com> rpeck@pure.com (Ray Peck) writes:
  12.   >
  13.   >The only problem with this is a WORD is not a portable concept (i.e.,
  14.   >people in 68k's call 16 bits a word, while people on Real Machines ;-)
  15.   >call 32 bits a word.  All modern machines use 32b and up.
  16.   >
  17.   >
  18.   >For this reason, I prefer types int8, int16, int32, or (better) u1b,
  19.   >u2b, u4b, (unsigned) and s1b, s2b, s4b (signed).
  20.   >
  21.  
  22. I've been thinking about doing it that way myself, but it seems to me that
  23. you would want two variants of each size: one for when you need EXACLTY
  24. that number of bits, and one when you just need AT LEAST that number of
  25. bits.  The former type would be used where the exact size matters (say,
  26. something you're reading from a file, or something used for bit flags).
  27. The latter type would be used for things like loop counters where you
  28. wanted to use the most efficient size that is sufficient.  For instance,
  29. the "at least 8 bit" type might be defined as a 32-bit int on a machine
  30. that had that as it's "natural" word size.
  31.  
  32. Opinions on that idea?
  33.  
  34.   >-- 
  35.   >Ray Peck                        rpeck@pure.com
  36.   >Pure Software                        415-903-5100
  37.   >
  38.  
  39. The guys who wrote Purify, right?  Awesome product!
  40.  
  41.  
  42. -- 
  43. Ed Driscoll
  44. Cimage Corp.
  45. ejd@cimage.com
  46.