🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #388

Re: struct comparison

#388
From: Guy Harris
Date: Fri, 28 Jul 1989 17:38
28 lines
1649 bytes
...

 >		char	bar;
 >		short	uh_oh;
 >	}
 >
 >Guess what happens?  The code breaks!!  By seemingly innocently adding
 >a field to the struct, you now have to go through and fix all the code
 >you broke.

Are you implying here that:

	1) "uh_oh" isn't supposed to be compared when you do structure
	   comparisons

or

	2) C-SEE compiles all structure comparisons into comparisons of
	   all the bytes of the structure?

If 2), I think it's been established that the *only* correct definition
of structure comparison would be member-by-member, and if that means the
structure comparison doesn't compile into e.g. a single "CMPCn"
instruction on a VAX, too bad.  While this may surprise some users of
the structure comparison construct (and, if it surprises a lot of them,
it means advocates of structure comparison had better be prepared to
educate said users), it means that adding a structure member that causes
padding to be added to a structure won't break structure comparisons.
Technical Details
Message-ID: <2297@auspex.auspex.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!cs.utexas.edu!uunet!auspex!guy
References: <2874@solo3.cs.vu.nl> <1989Jul14.155312.2063@utzoo.uucp> <2878@kappl.cs.vu.nl> <1989Jul15.210821.7950@utzoo.uucp> <167@ssp1.idca.tds.philips.nl> <1989Jul18.020424.2392@utzoo.uucp> <2335@trantor.harris-atd.com> <2261@auspex.auspex.com> <171@ssp <2267@auspe

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!cs.utexas.edu!uunet!auspex!guy
From: guy@auspex.auspex.com (Guy Harris)
Newsgroups: comp.std.c
Subject: Re: struct comparison
Message-ID: <2297@auspex.auspex.com>
Date: 28 Jul 89 17:38:48 GMT
References: <2874@solo3.cs.vu.nl> <1989Jul14.155312.2063@utzoo.uucp> <2878@kappl.cs.vu.nl> <1989Jul15.210821.7950@utzoo.uucp> <167@ssp1.idca.tds.philips.nl> <1989Jul18.020424.2392@utzoo.uucp> <2335@trantor.harris-atd.com> <2261@auspex.auspex.com> <171@ssp <2267@auspe
Reply-To: guy@auspex.auspex.com (Guy Harris)
Organization: Auspex Systems, Santa Clara
Lines: 28