home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.std.c
- 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
- From: msb@sq.sq.com (Mark Brader)
- Subject: Re: Must an object remain in place? (was: fwrite+fread of pointer)
- Message-ID: <1992Nov21.110226.24705@sq.sq.com>
- Organization: SoftQuad Inc., Toronto, Canada
- References: <1992Nov18.104542.8499@thunder.mcrcim.mcgill.edu> <1992Nov19.061601.13164@sq.sq.com> <7951@charon.cwi.nl>
- Date: Sat, 21 Nov 92 11:02:26 GMT
- Lines: 30
-
- > Well, examine the *as if* rule. I think a run-time system is able to
- > move data under the proviso that it is able to identify all pointers
- > and update them accordingly; even if they are stored in non-pointer type
- > variables. (I know of one Algol 68 garbage collector that did just that,
- > but it cheated. On a tagged architecture it would certainly be possible.)
-
- In theory maybe, but not in practice. Consider that you can transform
- a pointer to a character string with "%p" in sprintf(), do arbitrarily
- complex operations on the characters which end up reproducing the same
- string, then use "%p" in sscanf() to reconstruct the pointer, and the
- result must compare equal to the original pointer.
-
- If the "as if" rule is used to make objects movable, then I think it has
- to be done by a scheme with an extra level of indirection, such as the one
- I outlined in my previous posting in this subthread. In that scheme,
- the thing accessed by %p would not be the real pointer but a pointer
- to it, and the real pointer would be free to change.
-
-
- > The questions answered are different from the question what happens if you
- > write a pointer to file and read it back in.
-
- Since it's agreed that the writing and reading does not change the bits,
- I think it is all equivalent.
- --
- Mark Brader "People with whole brains, however, dispute
- SoftQuad Inc., Toronto this claim, and are generally more articulate
- utzoo!sq!msb, msb@sq.com in expressing their views." -- Gary Larson
-
- This article is in the public domain.
-