Path: utzoo!utgpu!cunews!micor!latour!revcan!darren From: darren@revcan.UUCP (Darren Morbey) Newsgroups: comp.lang.c Subject: Re: When do you use "if ( a = b )"? (was Re: Funny mistake) Message-ID: <150@revcan.UUCP> Date: 25 Mar 91 14:58:10 GMT References: <1991Mar18.195351.11985@unlv.edu> <357@ptcburp.ptcbu.oz.au> <3130@inews.intel.com> Organization: Revenue Canada, Taxation; Office Communications Division Lines: 23 In article <3130@inews.intel.com>, bhoughto@hopi.intel.com (Blair P. Houghton) writes: >In article <1991Mar19.192416.13756@unlv.edu> grover@lowell.cs.unlv.edu (Kevin Grover) writes: >>michi@ptcburp.ptcbu.oz.au (Michael Henning) writes: >>>grover@sonny-boy.cs.unlv.edu (Kevin Grover) writes: >>>> #define EQU == >>>> if ( a EQU b) >>>NO, NO, NO ! Please don't do this. >#define should _never_ be used to replace existing tokens. Just as a suggestion, what about: #define EQU(l,r) ((l)==(r)) /*...*/ if( EQU(a,b) ) I realize this is rather messy, because it "contribute[s] nothing to the readability of the code." (Mr. Henning) It does make the equality different from the assignment without violating "#define should _never_ be used to replace existing tokens." (Mr. Houghton) Pardon me for asking, but please define "obfuscation." P.S. I would find it useful to #define NOT(a) !(a), #define COMPL(a) ~(a), and #define XOR(a,b) ((a)^(b)). I have trouble remembering the use of the tilde and circumflex. Again, only a suggestion.