When do you use "if ( a = b )"?

Dan Bernstein brnstnd at kramden.acf.nyu.edu
Mon Apr 1 06:32:13 AEST 1991


In article <1991Mar30.155003.5775 at cc.helsinki.fi> wirzenius at cc.helsinki.fi (Lars Wirzenius) writes:
> The major point is, why should you have to? Using define to change the
> syntax essentially creates a new language, which forces everyone to
> learn it.

On the other hand, #define equ(a,b) ((a) == (b)) does not create a new
syntax or a new language---but it's still an extra semantic burden for
the reader. In fact, *anything* that extends the global namespace makes
the code more difficult to read. That's why you shouldn't even define a
function unless it encapsulates nontrivial semantic content.

---Dan



More information about the Comp.lang.c mailing list