When do you use "if ( a = b )"? (was Re: Funny mistake)

Kevin Grover grover at lowell.cs.unlv.edu
Wed Mar 20 05:24:16 AEST 1991


michi at ptcburp.ptcbu.oz.au (Michael Henning) writes:
) grover at sonny-boy.cs.unlv.edu (Kevin Grover) writes:
) 
) [ Stuff deleted I entirely agree with ]
) 
) >Also, if you get bitten but this bug often, try something like
) 
) >	#define EQU ==
) 
) >	if ( a EQU b)
) 
) >Instead of depending upon remembering to use '==' when you need to.
) 
) NO, NO, NO ! Please don't do this.

   [ misc. flame deleted ...]

) And besides, are you going to change every occurrence of == to EQU in every
) piece of code you will ever maintain ?  I don't think that you would make
) many friends that way, a lot of software maintenance relies on noise-free
) diff listings.

Just so you know, I agree completely.  I have never, and will never use such
a construct.  I merely thought if it on the fly, as a means to help those suffer
from that problem ( using = in place of ==) get alone with as little difficulty
as possible.

However, I do not understand why you are so against such a use of define.
I agree that it might be a pain on a continual basis, but any person who expects
to use C regularly will (hopefully) discover this, and finally learns that using
= in a test is very usefull, or possibly quite using C.

-- 
  +-------------------------------------------------+----------------------+
  | Kevin Grover             UNLV Computer Science  |     Home of the      |
  | grover at cs.unlv.edu       Las Vegas, Nevada      |    Running REBELS    |
  +-------------------------------------------------+----------------------+



More information about the Comp.lang.c mailing list