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