home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / c / 16762 < prev    next >
Encoding:
Text File  |  1992-11-18  |  1.8 KB  |  41 lines

  1. Xref: sparky comp.lang.c:16762 comp.std.c:3031
  2. Path: sparky!uunet!ferkel.ucsb.edu!taco!rock!stanford.edu!agate!doc.ic.ac.uk!uknet!acorn!ixi!clive
  3. From: clive@x.co.uk (Clive Feather)
  4. Newsgroups: comp.lang.c,comp.std.c
  5. Subject: Re: Idle Questions about ANSI C
  6. Message-ID: <1992Nov18.122631.22438@x.co.uk>
  7. Date: 18 Nov 92 12:26:31 GMT
  8. References: <1992Nov13.213708.5456@mccc.edu> <1992Nov14.162633.13199@taumet.com>
  9. Followup-To: comp.std.c
  10. Organization: IXI Limited, Cambridge, UK
  11. Lines: 28
  12.  
  13. [Crossposted to comp.std.c - followups there please]
  14.  
  15. In article <1992Nov14.162633.13199@taumet.com> steve@taumet.com (Steve Clamage) writes:
  16. > pjh@mccc.edu (P. J. Holsberg) writes:
  17. >> 1) Is "size_t" ever not the same as "unsigned int"? If so, in what situation?
  18. > If the address space is large but ints are small, size_t will be unsigned
  19. > long.  If address space is small but ints are large, you might want to
  20. > make size_t an unsigned short.  I've seen implementations like the first
  21. > case.  The second case seems unlikely.  Both could be Standard-conforming.
  22.  
  23. As far as I can tell, the second case is Standard-conforming. However,
  24. the Rationale says (4.1.6):
  25. | All library prototypes are specified in terms of the "widened" types:
  26. | an argument formerly declared as char is now written as int. This
  27. | ensures that most library functions can be called with or without a
  28. | prototype in scope.
  29. (and then goes on to point out that varargs functions need a prototype).
  30.  
  31. However, this is not true for malloc if size_t is unsigned short, and:
  32.  
  33.     extern void *malloc ();
  34.  
  35. causes undefined behaviour.
  36. -- 
  37. Clive D.W. Feather     | IXI Limited         | If you lie to the compiler,
  38. clive@x.co.uk          | Vision Park         | it will get its revenge.
  39. Phone: +44 223 236 555 | Cambridge   CB4 4RZ |   - Henry Spencer
  40. Fax:   +44 223 236 550 | United Kingdom      |
  41.