Article View: net.lang.c
Article #9188Re: Orphaned Response
From: karl
Date: Fri, 22 Aug 1986 17:43
Date: Fri, 22 Aug 1986 17:43
20 lines
1412 bytes
1412 bytes
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
Technical Details
Message-ID:
<86900024@haddock>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!think!ima!haddock!karlReferences:
<1133@ttrdc.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!think!ima!haddock!karl From: karl@haddock Newsgroups: net.lang.c Subject: Re: Orphaned Response Message-ID: <86900024@haddock> Date: Fri, 22-Aug-86 13:43:00 EDT Article-I.D.: haddock.86900024 Posted: Fri Aug 22 13:43:00 1986 Date-Received: Fri, 22-Aug-86 22:15:28 EDT References: <1133@ttrdc.UUCP> Lines: 20 Nf-ID: #R:ttrdc.UUCP:1133:haddock:86900024:000:890 Nf-From: haddock!karl Aug 22 13:43:00 1986