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

  1. Xref: sparky comp.lang.c:16682 comp.std.c:3016
  2. Newsgroups: comp.lang.c,comp.std.c
  3. Path: sparky!uunet!blaze.cs.jhu.edu!rhombus!wilson
  4. From: wilson@rhombus.cs.jhu.edu (Dwight Wilson)
  5. Subject: Re: Idle Questions about ANSI C
  6. Message-ID: <1992Nov17.205344.20279@blaze.cs.jhu.edu>
  7. Followup-To: comp.std.c
  8. Sender: news@blaze.cs.jhu.edu (Usenet news system)
  9. Organization: The Johns Hopkins University CS Department
  10. References: <BxqBp1.5M6@netnews.jhuapl.edu> <1992Nov17.123803.6400@thunder.mcrcim.mcgill.edu> <1992Nov17.155826.15087@sq.sq.com>
  11. Date: Tue, 17 Nov 1992 20:53:44 GMT
  12. Lines: 27
  13.  
  14.  
  15. In article <1992Nov17.155826.15087@sq.sq.com> msb@sq.sq.com (Mark Brader) writes:
  16. >> > According to K+R 2nd ed, section A7.4.8, size_t is "an unsigned
  17. >> > integral constant; the particular type in implementation defined".
  18. >> 
  19. >> Well, the result of sizeof is the quoted thing, and it notes that
  20. >> <stddef.h> defines the type in question as size_t.
  21. >> 
  22. >> Now: is it required that size_t be the same as one of the four usual
  23. >> unsigned integral types?  (How about ptrdiff_t?)
  24. >
  25. >The wording of section 3.1.2.5/6.1.2.5 of the standard clearly implies
  26. >that the 9 "usual" integral types are the only ones.  They consist of
  27. >4 signed integer types, 4 unsigned integer types, and char -- which
  28. >of course can be either signed or unsigned.  Since size_t and ptrdiff_t
  29. >are specified respectively as unsigned or signed *integral* types, not
  30. >*integer* types, then an implementation could actually use char for
  31. >one of them -- remember, it could be the same size as int or even long.
  32. >So there are 5 possibilities for each.
  33.  
  34. To get nitpicky, section 3.3.3.4 states that size_t is an
  35. unsigned integral type.  Section 3.1.2.5 discusses the integral
  36. types.  As I read it, no matter what its implementation, char is 
  37. neither an unsigned integral type nor a signed integral type.  Thus,
  38. there are 4 possibilites for size_t and ptrdiff_t.
  39.  
  40. -Dwight
  41.