Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!csd4.milw.wisc.edu!bionet!ames!haven!ncifcrf!nlm-mcs!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.std.c Subject: Re: struct comparison Message-ID: <10534@smoke.BRL.MIL> Date: 15 Jul 89 05:22:55 GMT References: <2874@solo3.cs.vu.nl> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 21 In article <2874@solo3.cs.vu.nl> maart@cs.vu.nl (Maarten Litmaath) writes: >Is the ANSI committee trying to tell us the compiler cannot transform the >equality test into the correct member-by-member comparison code? No, but apart from the padding issue it is not clear what would constitute "equality" in practice; memberwise comparison would seldom be what one really wanted. Consider char* members, for example; probably struct equality in such a case should use the equivalent of strcmp() on those members. Floating-point equality tests are usually meaningless (except sometimes when one of the operands is precisely zero). Union members pose yet another problem. And so on. Given such pratical problems, and that a programmer can perform this test another way, and that it would be an "invention", X3J11 chose not to require support for aggregate equality testing. There were an immense number of suggestions for such linguistic enhancements received by X3J11, as listed in the introduction to each official public review response document. If there is much interest, I could post the list in order to give you a better appreciation of why such suggestions were routinely rejected.