Path: utzoo!utgpu!water!watmath!clyde!bellcore!faline!ulysses!allegra!mit-eddie!uw-beaver!ssc-vax!cxsea!blm From: blm@cxsea.UUCP Newsgroups: comp.lang.c Subject: Re: structure comparison Message-ID: <2330@cxsea.UUCP> Date: 15 Jan 88 16:40:51 GMT References: <1322@sugar.UUCP> <1942@ho95e.ATT.COM> <1373@sugar.UUCP> <2456@ihlpe.ATT.COM> <10175@mimsy.UUCP> Reply-To: blm@cxsea.UUCP (Brian Matthews) Organization: Computer X Inc. Lines: 22 Posted: Fri Jan 15 11:40:51 1988 Chris Torek (chris@mimsy.UUCP) writes: |In article <2456@ihlpe.ATT.COM> woods@ihlpe.ATT.COM (Swan) writes: |>The problem is that the compiler cannot be sure how many bytes in the |>structures to compare for [in]equality. |This is easily solved by simply defining it to compare all elements |of the structure and no holes. Unions become problematical, but |this, too, is easily solved, by outlawing comparison of things that |contain unions. What do you do about things like char x[10]? How does the compiler know that (and if) you want to compare a null-terminated string, as opposed to every character? Also, what about the fairly common practice of having the last item be of indeterminate size (at compile time)? In my opinion, there are too many special cases to make structure comparison useful (and usable). -- Brian L. Matthews "A power tool is not a toy. ...{mnetor,uw-beaver!ssc-vax}!cxsea!blm Unix is a power tool." +1 206 251 6811 Computer X Inc. - a division of Motorola New Enterprises