ending the debate over = vs. ==
Rick Genter
rgenter at BBN-LABS-B.ARPA
Wed Jul 2 01:13:30 AEST 1986
I'm getting tired of reading about = vs. ==, so I am going to make a
proposal that should end the debate once and for all.
The points which have been outlined so far are:
* == is too easy to mistype as =, and C treats = as an operator, so
no error gets flagged;
* = is shorter than ==, and since assignment is used more frequently
than the equality comparison, this is as it should be;
* other languages use := for assignment and = for equality and don't
seem to have any problem, although some of them don't allow
assignment embedded within expressions, so this is a moot point;
* various arguments about what mathematicians think.
Notice that this debate never came up in Fortran. Since I believe in
learning from the past, I propose that
* the assignment operator be changed to .GETS.
* the equality operator be changed to .IS.EQUAL.TO.
The meaning is obvious and doesn't get confused with current mathematical
symbols. The assignment operator is shorter than the equality operator.
Fortran has used a similar symbology for 30 years now. It's not likely that
you could mistype one as the other.
As an added bonus, a special preprocessor switch could be added to allow
an alternative form of the equality operator to be recognized, namely .ZEKWAL2,
which involves even less typing, yet retains all of the above properties (with
the possible exception of obvious meaning). I propose naming this switch -RBJ.
So there.
--------
Rick Genter BBN Laboratories Inc.
(617) 497-3848 10 Moulton St. 6/512
rgenter at labs-b.bbn.COM (Internet new) Cambridge, MA 02238
rgenter at bbn-labs-b.ARPA (Internet old) linus!rgenter%BBN-LABS-B.ARPA (UUCP)
More information about the Comp.lang.c
mailing list