struct comparison

Doug Gwyn gwyn at smoke.BRL.MIL
Fri Jul 21 09:45:46 AEST 1989


In article <2261 at auspex.auspex.com> guy at auspex.auspex.com (Guy Harris) writes:
>Simple "compare all bytes" is certainly simple; how useful it is is
>another question, given that comparing padding bytes is simply wrong,
>unless you *guarantee* that they're always going to have some "standard"
>value that gets in the way.

Comparing padding is wrong anyway.  Even if you could arrange for it to
"contain" some standard value (and I'm not sure how you could do that in
standards language), there is no constraint so far that says that value
must still be there later.  

The obvious definition of struct comparison would be:
	structs compare equal if and only if all their corresponding
	members compare equal.
I assure you that it was considered as one of the zillion proposed C
language extensions received by X3, but its benefits were not shown to
outweigh its drawbacks.



More information about the Comp.std.c mailing list