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

  1. Newsgroups: comp.std.c
  2. Path: sparky!uunet!utcsri!newsflash.concordia.ca!sifon!thunder.mcrcim.mcgill.edu!mouse
  3. From: mouse@thunder.mcrcim.mcgill.edu (der Mouse)
  4. Subject: Re: fwrite+fread of pointer
  5. Message-ID: <1992Nov18.104542.8499@thunder.mcrcim.mcgill.edu>
  6. Organization: McGill Research Centre for Intelligent Machines
  7. References: <15935@goanna.cs.rmit.oz.au> <1992Nov13.184421.11065@taumet.com> <15977@goanna.cs.rmit.oz.au>
  8. Date: Wed, 18 Nov 92 10:45:42 GMT
  9. Lines: 34
  10.  
  11. In article <15977@goanna.cs.rmit.oz.au>, ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) writes:
  12. > In article <1992Nov13.184421.11065@taumet.com>, steve@taumet.com (Steve Clamage) writes:
  13.  
  14. >> "Data read in from a binary stream shall compare equal to the data
  15. >> that were earlier written out to the stream, [...]."
  16. > That is exactly the kind of answer I hoped for when I posted to
  17. > comp.std.c.  Thank you.  There remains, alas, one fine point of
  18. > detail.  What does it _mean_ to say "COMPARE EQUAL to the data ..."?
  19.  
  20. Let's see if I can bring this into sharper relief by eliminating the
  21. file.  Since I think we now agree that a block of bytes written out and
  22. read back must produce a block of bytes with identical bits in them....
  23.  
  24. int *p;
  25. int dummy;
  26. char tmp[sizeof(int *)];
  27.  
  28. p = &dummy;
  29. memcpy(&tmp[0],&p,sizeof(int *));
  30.  
  31. /* insert other code here, not touching any
  32.    of these three variables, if you feel like it */
  33.  
  34. memcpy(&p,&tmp[0],sizeof(int *));
  35.  
  36. /* at this point, must p == &dummy?  Must a reference to *p access the
  37.    same object a similar reference to dummy would? */
  38.  
  39. Note that the two questions do not ask quite the same thing, I think.
  40.  
  41.                     der Mouse
  42.  
  43.                 mouse@larry.mcrcim.mcgill.edu
  44.