Re^3 (was 2): struct comparison

Dave Decot decot at hpisod2.HP.COM
Tue Jul 25 09:25:56 AEST 1989


I really don't see any problem with a definition of structure comparison
that said two comparable structures match if and only if the corresponding
elements compare equal.

If an implementation wants to make holes in structures, that's fine;
it just has to deal with avoiding the holes when generating code to
compare the structures.  An application wishing to compare strucutres
(or things which are potentially structures) should be willing to
put up with a little delay.

Or, if it's smart enough to notice that the particular structures
involved are never modified via aliases, the compiler could initialize
them with 0's in the holes and not worry about them when comparing.

As Donn Terry points out, most of the structures one wants to compare
in practice have no holes, anyway.

Dave



More information about the Comp.std.c mailing list