Article View: comp.std.c
Article #2988Re: Must an object remain in place? (was: fwrite+fread of pointer)
From: John F. Woods
Date: Mon, 23 Nov 1992 16:28
Date: Mon, 23 Nov 1992 16:28
21 lines
1557 bytes
1557 bytes
msb@sq.sq.com (Mark Brader) writes:
>> 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.
That's a pretty strong requirement, I think, but still not quite enough to
(by itself) ensure that the contents of pointer variables may not change
during execution:
printf("%p\n", ptr);
could yield something like "<The Object Named Fred-0007>", if the architecture
supported some other constant naming scheme for objects other than their
virtual bus addresses.
Technical Details
Message-ID:
<19173@ksr.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!world!ksr!jfwReferences:
<1992Nov18.104542.8499@thunder.mcrcim.mcgill.edu> <1992Nov19.061601.13164@sq.sq.com> <7951@charon.cwi.nl> <1992Nov21.110226.24705@sq.sq.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!world!ksr!jfw From: jfw@ksr.com (John F. Woods) Newsgroups: comp.std.c Subject: Re: Must an object remain in place? (was: fwrite+fread of pointer) Message-ID: <19173@ksr.com> Date: 23 Nov 92 11:28:37 EST References: <1992Nov18.104542.8499@thunder.mcrcim.mcgill.edu> <1992Nov19.061601.13164@sq.sq.com> <7951@charon.cwi.nl> <1992Nov21.110226.24705@sq.sq.com> Sender: news@ksr.com Lines: 22