C Style
Brian T. Schellenberger
bts at sas.UUCP
Mon Apr 25 12:10:38 AEST 1988
In article <20126 at think.UUCP> barmar at fafnir.think.com.UUCP (Barry Margolin) writes:
|[for one-bit bit fields]
|it would be nice to be able to say flag = isXXX(...) rather
|than flag = (isXXX(...) != FALSE). But this is just a wish; portable
|code must currently use the more verbose version.
(I will probably start a "if( a = b )"-type flame war for this, but):
I prefer the shorter form:
flag = !!isXXX(...)
You can think of "!!" as the "truth-value-of" or "convert-to-canonical-boolean"
operator.
( To forestall 10 "I didn't know there was such an operator" postings: )
( This is "!" followed by "!": )
( non-zero -> 0 -> 1 )
( 0 -> 1 -> 0 )
--
--Brian.
(Brian T. Schellenberger) ...!mcnc!rti!sas!bts
. . . now at 2400 baud, so maybe I'll stop bothering to flame long includes.
More information about the Comp.lang.c
mailing list