home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / std / c / 2631 < prev    next >
Encoding:
Text File  |  1992-09-15  |  2.1 KB  |  42 lines

  1. Newsgroups: comp.std.c
  2. Path: sparky!uunet!utcsri!geac!r-node!druid!darcy
  3. From: darcy@druid.uucp (D'Arcy J.M. Cain)
  4. Subject: Re: calloc()
  5. Message-ID: <1992Sep15.173043.18556@druid.uucp>
  6. Date: Tue, 15 Sep 1992 17:30:43 GMT
  7. References: <1992Sep10.180542.1009@taumet.com> <1992Sep13.142340.24107@druid.uucp> <1992Sep14.175431.10043@taumet.com>
  8. Organization: D'Arcy Cain Consulting
  9. Lines: 31
  10.  
  11. steve@taumet.com (Steve Clamage) writes:
  12. >darcy@druid.uucp (D'Arcy J.M. Cain) writes:
  13. >>steve@taumet.com (Steve Clamage) writes:
  14. >>>That said, suppose we have a system where int and size_t are 16 bits,
  15. >>>but it is possible to allocate an object bigger than 64K.  A
  16. >>But isn't size_t guaranteed to be big enough to specify any object?  It
  17. >size_t is the type returned by the sizeof operator.  I believe you
  18. >must be able to apply sizeof to any object you can declare.  Suppose
  19.  
  20. Mark Brader and I have been discussing this in email and I agree that
  21. in the case of calloc (but not malloc) a stricly conforming compiler
  22. might be able to allocate more bytes (but not elements) than can fit
  23. into a size_t.  Here is an excerpt from my last message to him:
  24.  
  25. >Actually 4.10.3 never comes down on one side or the other but it does say
  26. >that "Each allocation shall yield a pointer to an object disjoint from
  27. >any other object."  Now of course you can't apply sizeof to the object
  28. >because you only have a pointer to the object and hence you can only get
  29. >the size of the pointer or the size of the first element.  However the
  30. >discussion on sizeof does sort of imply that if you could somehow get
  31. >an identifier for the object itself that sizeof could be applied to it
  32. >and therefore size_t must be able to represent its size.  And of course
  33. >if pigs had wings they might fly so I am not sure if I've proved anything
  34. >other than that I come to these strange conclusions due to too much
  35. >thought rather than too little.  :-)
  36.  
  37. -- 
  38. D'Arcy J.M. Cain (darcy@druid.com)  |
  39. D'Arcy Cain Consulting              |   There's no government
  40. Toronto, Ontario, Canada            |   like no government!
  41. +1 416 424 2871          DoD#0082   |
  42.