Precedent for use of =

Dave Haynie daveh at cbmvax.cbm.UUCP
Wed Jun 25 03:22:09 AEST 1986


> Here is where you will, with some, `run into a brick wall' (as they
> never did say in Bree).  Some will claim that it *is* broken,
> because people do at times write
> 
> 	if (var = expr) ...
> 
> when they in fact meant
> 
> 	if (var == expr) ...
> 
> As for myself, I believe that anyone can do bad things in any
> language (includin' English like I's a-doin' right here now right
> before your very own eyes doncha know :-) ), and that the proper
> measure of a language is not how difficult it makes writing bad
> code, but rather how easy it makes writing good code.
> -- 
I could just as easily write in PASCAL, M2, or ADA

   IF var := expr THEN ...

when I mean

   IF var = expr THEN ...

Of course the compiler will flag me about this, but what I get for that
compiler error message is the loss of my assignment OPERATOR, replaced
by a special case of assignment, the assignment STATEMENT.  Certainly there
may be less chance of error with the PASCAL style arrangement, at least
for beginners.  But I KNOW C, and even at 4:00 AM I don't think I've made
the assignment/comparison transposition error for a few years.  But I use
assignment as an operator ALL THE TIME.  The PASCAL syntax is like much
about PASCAL versus C; PASCAL forces you into a limited means of expression
in return for catching your errors for you.  This is like giving a dull
scalpel to a surgeon; he can't cut himself with it.

> In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 1516)
> UUCP:	seismo!umcp-cs!chris
> CSNet:	chris at umcp-cs		ARPA:	chris at mimsy.umd.edu
-- 
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Dave Haynie    {caip,ihnp4,allegra,seismo}!cbmvax!daveh

   A quote usually goes here, but its currently being rennovated.

	These opinions are my own, though for a small fee they be yours too.
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/



More information about the Comp.lang.c mailing list