[TUHS] C question for the historians

Warner Losh imp at bsdimp.com
Thu Nov 9 06:36:40 AEST 2017


On Wed, Nov 8, 2017 at 12:05 PM, Larry McVoy <lm at mcvoy.com> wrote:

> On Wed, Nov 08, 2017 at 06:14:20PM +0000, Ralph Corderoy wrote:
> > is better then why stop there?  Why not
> >
> >     if (((w & MASK) != FALSE) == TRUE)
>
>
> Thanks for this, that's the perfect come back to the pedantic folks.
>

It's also wrong. You couldn't flip it around to write

 if (((w & MASK) == TRUE) == TRUE)

because that only works when MASK == 1. So it's dangerous since you can't
apply the normal laws of algebra on it because you are comparing BOOLEANS
and MASKS, which has always ended in pain...

Warner
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20171108/d90d3972/attachment.html>


More information about the TUHS mailing list