Article View: comp.std.c
Article #1165Re: How is struct assignment defined (idle query)?
From: Gordon Burditt
Date: Sat, 05 Sep 1992 07:03
Date: Sat, 05 Sep 1992 07:03
20 lines
1275 bytes
1275 bytes
>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
Technical Details
Message-ID:
<Bu3FMw.II4@sneaky.lonestar.org>Path:
arc1-ca.pugleaf.net!sparky!uunet!haven.umd.edu!darwin.sura.net!convex!news.oc.com!utacfd.uta.edu!rwsys!sneaky!gordonReferences:
<715547606snx@grendel.demon.co.uk>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c Path: arc1-ca.pugleaf.net!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