Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!uupsi!cmcl2!adm!smoke!gwyn From: gwyn@smoke.brl.mil (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: Is simple assignment allowed with structs Message-ID: <15896@smoke.brl.mil> Date: 18 Apr 91 18:58:48 GMT References: <1991Apr8.073710.22673@netcom.COM> <15766@smoke.brl.mil> <1991Apr18.095803.11624@netcom.COM> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 15 In article <1991Apr18.095803.11624@netcom.COM> avery@netcom.COM (Avery Colter) writes: >And so the mindless philosopher asks, "Yes, but WHY was it decided that >simple struct assignment had universal semantics?" The reasoning is that if you copy all the member values for a structured object, you have copied the value of the object itself. Of course there are situations where this isn't quite the sort of copying that one really wants, but it is simple, well-defined, and useful. >I suggest it was for the reason I stated, that the memory offsets are the >same for all variables of the same type of struct. No -- while the latter condition happens to be true, I don't see that it has any particular force as an argument for supporting structure assignment. ("Necessary but not sufficient.")