struct comparison

Mike I'll think of something yet Meyer mwm at eris.berkeley.edu
Sat Jul 22 12:14:41 AEST 1989


Can I point out something that I haven't seen mentioned here yet?

It's called "maintenance."

Consider the current situation. If you've got a structure that you
need to do comparison ons, and are thinking, you'll have an include
file with the structure & a comparison macro for that structure.

When you change the structure - in any way - you have the macro in the
same place, and can change it right there as apropos for the addition.

Now, assume you're using the hypothetical "struct comparison", you
don't have a macro - just the structure definition. If you change the
structure, you may not think about changing the equality test (no
macro nearby to remind you). When you do change it, you have to verify
that the default comparison is still legal and correct. If you need to
write a macro, you'll have to find every place that comparison is
used, and fix it. If the comparison is illegal, this isn't hard, just
tedious. If it's legal, it could be a pain.

While not something that would make you want to toss the facility
completely, it's yet another argument against it. The feature seems to
die the death of a thousand cuts.

BTW, my standard answer to people who _insist_ that C ought to have a
feature is:

	Get a copy of GNU C, and add that feature. Then, when
	they do the next revision of the standard, you'll have
	"prior practice" for the committe.  This is a lot more
	likely to get it added than arguing about it on USEnet.
	Besides which, you'll be able to write non-conforming
	code that uses that feature in the meantime.


	<mike

--
I went down to the hiring fair,				Mike Meyer
For to sell my labor.					mwm at berkeley.edu
I noticed a maid in the very next row,			ucbvax!mwm
I hoped she'd be my neighbor.				mwm at ucbjade.BITNET



More information about the Comp.std.c mailing list