== vs =
Roger Fujii
fujiirm at yendor.UUCP
Sat Feb 20 08:06:00 AEST 1988
In article <909 at micomvax.UUCP>, ray at micomvax.UUCP (Ray Dunn) writes:
> In article <11523 at brl-adm.ARPA> dsill at NSWC-OAS.arpa (Dave Sill) writes:
> >Does it make sense to change the language because some people have a
> >problem making the abstract <=> real transformation?
>
> Yes. Otherwise it will eventually be the cause of someone's death, and that
> death is avoidable!
This argument is doesn't work. There is a BETTER chance of killing someone if
you CHANGE the language ("Oh, How was I supposed to know you were going
to use an OLD compiler where the = meant something else"). Changing the
language defeats one of C's strong points - portability.
> To others who suggest defining "EQUALS" etc for "==". This is not a
> solution. The problem is not with the use of "==", the problem is with the
> use of "=". The solution *has* to involve the "=" operator. It
> unfortunately cannot be solved without breaking existing code - although
> only to the extent that syntax errors would be given on existing code by
> "new" compilers.
"Solution" implies there is a problem with the language. I state that the
problem is with the USER. Follow the following example: C is the *FIRST*
language that you learn. For a "pure" novice (one who has NOT been tainted
with Fortran, BASIC.....), the =/== will have clear, distinct and sensible
meanings (except for the occasional typo, which is easier to find than a
mistyped number - ah, you're going to redefine numbers now.... :-).
>
> The "best" solution suggested so far was to disallow "=" in the context of
> the conditional expression of an if statement, and substitute some other
> operator, say ":=" (but not necessarily).
>
Good, so ban cars that go faster than 20 mph because some people can't handle
that speed. The whole point is this: C is fairly consistant (I don't want
to hear about <<,>>). Changing the =/== in C is like changing forth to
compute numbers using the order of operations (slight :-) overexaggeration,
but you get the point). C is a powerful language, and it derives its
power by being "close" to the machine. This necessarily implies that it
can also be very DANGEROUS if used carelessly (as with any other powerful
things). *** C IS NOT A LANGUAGE FOR NOVICES *** If you expect C to protect
you from what you are telling it to do, you are not being realistic.
Now, I am sure that you won't find too many complaints if you GIVE a compiler
a flag to *warn* you if you do assignments in ifs (cc -trainingwheels hello.c),
but this should only be a diagnostic tool. The =/== does function and is
consistent. Remember the old saying - If it ain't broke, don't fix it.
--
Roger Fujii - ACT, Reston, VA Phone: (703)471-9433
Internet: fujiirm at cml.rpi.edu
UUCP: ..!{mimsy,sundc}!{prometheus,hqda-ai}!yendor!fujiirm
More information about the Comp.lang.c
mailing list