Article View: comp.std.c
Article #2960Re: fwrite+fread of pointer
From: der Mouse
Date: Wed, 18 Nov 1992 10:45
Date: Wed, 18 Nov 1992 10:45
33 lines
1719 bytes
1719 bytes
In article <15977@goanna.cs.rmit.oz.au>, ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) writes: > In article <1992Nov13.184421.11065@taumet.com>, steve@taumet.com (Steve Clamage) writes: >> "Data read in from a binary stream shall compare equal to the data >> that were earlier written out to the stream, [...]." > That is exactly the kind of answer I hoped for when I posted to > comp.std.c. Thank you. There remains, alas, one fine point of > detail. What does it _mean_ to say "COMPARE EQUAL to the data ..."? Let's see if I can bring this into sharper relief by eliminating the file. Since I think we now agree that a block of bytes written out and read back must produce a block of bytes with identical bits in them.... int *p; int dummy; char tmp[sizeof(int *)]; p = &dummy; memcpy(&tmp[0],&p,sizeof(int *)); /* insert other code here, not touching any of these three variables, if you feel like it */ memcpy(&p,&tmp[0],sizeof(int *)); /* at this point, must p == &dummy? Must a reference to *p access the same object a similar reference to dummy would? */ Note that the two questions do not ask quite the same thing, I think. der Mouse mouse@larry.mcrcim.mcgill.edu
Technical Details
Message-ID:
<1992Nov18.104542.8499@thunder.mcrcim.mcgill.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!utcsri!newsflash.concordia.ca!sifon!thunder.mcrcim.mcgill.edu!mouseReferences:
<15935@goanna.cs.rmit.oz.au> <1992Nov13.184421.11065@taumet.com> <15977@goanna.cs.rmit.oz.au>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c Path: arc1-ca.pugleaf.net!sparky!uunet!utcsri!newsflash.concordia.ca!sifon!thunder.mcrcim.mcgill.edu!mouse From: mouse@thunder.mcrcim.mcgill.edu (der Mouse) Subject: Re: fwrite+fread of pointer Message-ID: <1992Nov18.104542.8499@thunder.mcrcim.mcgill.edu> Organization: McGill Research Centre for Intelligent Machines References: <15935@goanna.cs.rmit.oz.au> <1992Nov13.184421.11065@taumet.com> <15977@goanna.cs.rmit.oz.au> Date: Wed, 18 Nov 92 10:45:42 GMT Lines: 34