Orphaned Response
karl at haddock
karl at haddock
Sat Aug 23 03:43:00 AEST 1986
ttrdc!levy (Dan Levy) writes:
>whatsa matter with "#define biff(pow) { if (pow) kayo(); else oof(); }"?
Since biff is now a complete statement (no trailing semicolon required), you
still can't write "if (...) biff(pow); else ...". You could leave out the
semicolon, but this requires the user to know that biff is implemented this
way. This is why the unusual definition "do {...} while (0)" (no trailing
semicolon) has been offered.
Ideally, it's nice for a macro to be an expression, since the function call
it resembles is an expression. Thus ?: is preferred when possible. (It is
evidently *not* possible in some compilers yet.)
>Bright (et al) have been saying "change the definition of C to allow this."
It's not clear whether this involves a change in the definition, or just a
bug fix in some existing compilers.
Karl W. Z. Heuer (ihnp4!ima!haddock!karl), The Walking Lint
More information about the Comp.lang.c
mailing list