home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / std / c / 2574 < prev    next >
Encoding:
Text File  |  1992-09-07  |  1.2 KB  |  31 lines

  1. Newsgroups: comp.std.c
  2. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!convex!news.oc.com!utacfd.uta.edu!rwsys!sneaky!gordon
  3. From: gordon@sneaky.lonestar.org (Gordon Burditt)
  4. Subject: Re: How is struct assignment defined (idle query)?
  5. Message-ID: <Bu3FMw.II4@sneaky.lonestar.org>
  6. Organization: Gordon Burditt
  7. References: <715547606snx@grendel.demon.co.uk>
  8. Date: Sat, 5 Sep 1992 07:03:55 GMT
  9. Lines: 20
  10.  
  11. >Does ANSI say that structure assignment is done by member-wise copy or
  12. >by bit-wise copying?
  13.  
  14. How would a standard-conforming program tell the difference?
  15.  
  16. >The reason I ask is that if it is a bit-wise copy, then any padding in
  17. >a struct would have to have some (presumably inplementation defined)
  18. >value written to it so that the padding bytes could be copied.
  19.  
  20. No, either the implementation has to use a method of copying that
  21. will copy uninitialized memory (without causing faults, etc.), OR
  22. it has to arrange that padding is initialized, OR it has to
  23. do an element-by-element copy.  (Warning:  element-by-element
  24. copies had better avoid problems with floating-point trapping NaNs
  25. if the implementation supports them.)  I suspect most
  26. implementations choose the first possibility.
  27.  
  28.  
  29.                     Gordon L. Burditt
  30.                     sneaky.lonestar.org!gordon
  31.