Precedent for use of =

Dave Haynie daveh at cbmvax.cbm.UUCP
Wed Jul 9 01:04:14 AEST 1986


> Personally, I still prefer := for assignment and = for equality over =
> and ==.  I also think that the keystroke argument is ridiculous (flames
> to /dev/null).  The problem with = and == is further aggravated by the
> fact that in C an assignment is an expression and not a statement, so
> that code like
> 
>   if (i = 0) {
>     /* do something */
>   }
>   else {
>     /* do something else */
>   }
> 
> is legal C and usually  /* does something else */   than you expected  :-)

As long as you're writing in C, and you REALLY know the language, the above
construct would be ridiculous.  I think that most of the folks that are
unhappy with the way that C handles = and == are frustrated Pascal hackers
who can't quite adjust to the power and terseness of C.  Maybe if they'd
spend a few extra hours LEARNING C instead of trying to write Pascal in C,
they'd be much better off.  I've had no trouble switching to := and = for
Pascal and M2, = and .EQ. for Fortran, = and = for BASIC, = and EQ() for
SNOBOL, MAKE and = for LOGO, (LET ), (SET ), (SETQ ) and (EQ ), (EQUAL ) 
in LISP, or even MOVE and CMP in Assembler.  My point is instead of 
tripping over the language syntax and screaming how it should be changed,
one can learn the language and then not have to worry about tripping over 
it.  And then you might even start to realize why a particular method has 
its advantages.

-- 
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
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