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

  1. Newsgroups: comp.std.c
  2. Path: sparky!uunet!noc.near.net!news.Brown.EDU!qt.cs.utexas.edu!cs.utexas.edu!zaphod.mps.ohio-state.edu!uunet.ca!wildcan!sq!msb
  3. From: msb@sq.sq.com (Mark Brader)
  4. Subject: Re: Must an object remain in place? (was: fwrite+fread of pointer)
  5. Message-ID: <1992Nov21.110226.24705@sq.sq.com>
  6. Organization: SoftQuad Inc., Toronto, Canada
  7. References: <1992Nov18.104542.8499@thunder.mcrcim.mcgill.edu> <1992Nov19.061601.13164@sq.sq.com> <7951@charon.cwi.nl>
  8. Date: Sat, 21 Nov 92 11:02:26 GMT
  9. Lines: 30
  10.  
  11. > Well, examine the *as if* rule.  I think a run-time system is able to
  12. > move data under the proviso that it is able to identify all pointers
  13. > and update them accordingly; even if they are stored in non-pointer type
  14. > variables.  (I know of one Algol 68 garbage collector that did just that,
  15. > but it cheated.  On a tagged architecture it would certainly be possible.)
  16.  
  17. In theory maybe, but not in practice.   Consider that you can transform
  18. a pointer to a character string with "%p" in sprintf(), do arbitrarily
  19. complex operations on the characters which end up reproducing the same
  20. string, then use "%p" in sscanf() to reconstruct the pointer, and the
  21. result must compare equal to the original pointer.
  22.  
  23. If the "as if" rule is used to make objects movable, then I think it has
  24. to be done by a scheme with an extra level of indirection, such as the one
  25. I outlined in my previous posting in this subthread.  In that scheme,
  26. the thing accessed by %p would not be the real pointer but a pointer
  27. to it, and the real pointer would be free to change.
  28.  
  29.  
  30. > The questions answered are different from the question what happens if you
  31. > write a pointer to file and read it back in.
  32.  
  33. Since it's agreed that the writing and reading does not change the bits,
  34. I think it is all equivalent.
  35. -- 
  36. Mark Brader            "People with whole brains, however, dispute
  37. SoftQuad Inc., Toronto         this claim, and are generally more articulate
  38. utzoo!sq!msb, msb@sq.com     in expressing their views."    -- Gary Larson
  39.  
  40. This article is in the public domain.
  41.