When do you use "if ( a = b )"? (was Re: Funny mistake)
Darren Morbey
darren at revcan.UUCP
Tue Mar 26 00:58:10 AEST 1991
In article <3130 at inews.intel.com>,
bhoughto at hopi.intel.com (Blair P. Houghton) writes:
>In article <1991Mar19.192416.13756 at unlv.edu>
grover at lowell.cs.unlv.edu (Kevin Grover) writes:
>>michi at ptcburp.ptcbu.oz.au (Michael Henning) writes:
>>>grover at 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.
More information about the Comp.lang.c
mailing list