Is simple assignment allowed with structs
Doug Gwyn
gwyn at smoke.brl.mil
Sun Mar 31 08:24:28 AEST 1991
In article <AJ3U.91Mar30161251 at wilbury.ra.cs.virginia.edu> aj3u at wilbury.ra.cs.virginia.edu (Asim Jalis) writes:
>The assignment from all appearances seems to copy both the fields of a
>to b. My question is, is such assignment legal. Can I expect other
>compilers to support this? Or should I explicitly assign the fields
>to ensure portability.
Structure assignment has been an official part of C since around 1978.
While there MAY be some things loosely called "C compilers" that do not
support this, all the current C compilers that I know of do support it.
Since the C standard requires it for conforming implementations, there
should be no future C compilers that do not understand this.
>I tried adding two structs and that did not work.
Of course not. What would it mean?
More information about the Comp.lang.c
mailing list