Using Macros

Karl Heuer karl at haddock.ima.isc.com
Fri Aug 10 08:40:33 AEST 1990


The source of the problem is the name of the macro.  It's not at all clear
whether `CHECK' should mean `assert' or `forbid'.

In article <1752 at tuvie> hp at vmars.tuwien.ac.at (Peter Holzer) writes:
>Karl obviously interpreted it the same way [as a `forbid' macro]

I noticed that the `||' version had the `assert' semantics, which I retained
in my second example (which I actually wrote first), assuming this was the
intent.  I then wrote the `?:' version while looking at the `if' version of
the original.  I even checked it against the copy in <assert.h>, noting that
the operands were in the opposite order, which I accepted because the `if'
version did indeed have the semantics of `forbid' rather than `assert'.  It
completely slipped my mind that I'd just made the opposite observation a
minute earlier!

>It is amazing though, that the Walking Lint missed the ||-&& confusion.

What I missed was that the two versions were inconsistent--I actually had the
right model for `a || b' in mind.

Karl W. Z. Heuer (karl at kelp.ima.isc.com or ima!kelp!karl), The Walking Lint



More information about the Comp.lang.c mailing list