This one bit me today

6600pete at ucsbuxa.ucsb.edu 6600pete at ucsbuxa.ucsb.edu
Tue Oct 17 14:35:07 AEST 1989


In article <192700007 at hollin> ds at hollin.prime.com writes:

   I could never get used to the difference between = and ==, so I use
   "#define EQ ==" (and "#define NE !=" for symmetry) as part of my
   standard defines at the start of every program.  While the lexical
   distinction remains, it is now reflected more thoroughly by the
   difference between punctuation and alphabetical characters.

Another good way to do this, at least when comparing to a constant, is
to put the constant first in an expression, like so

   if ( 1 == x ) {

No C compiler will accept

   if ( 1 = x ) {



More information about the Comp.lang.c mailing list