cvs commit: src/sys/dev/pccard pccard.c pccardvar.h

Nate Lawson nate at root.org
Thu Apr 10 12:28:19 PDT 2003


On Thu, 10 Apr 2003, Warner Losh wrote:
> In message <XFMail.20030410124202.jhb at FreeBSD.org> John Baldwin writes:
> : At this point it doesn't matter since you only check one field now, but
> : there was definitely a logic bug in both 1.76 and 1.78.  If you want to
> : terminate a loop when both a and b are zero, you can do either:
> : 
> :         for (...; a != 0 || b != 0; ...)
> : 
> : or:
> : 
> :         for (...; !(a == 0 && b == 0); ...)
> : 
> : However, both 1.76 and 1.78 did:
> : 
> :         for (...; a != 0 && b != 0; ...)
> : 
> : Which will terminate the first time either a or b is zero, not when
> : both are zero.  The fact that my wavelan card didn't probe until
> : 1.77 should help to prove that.
> 
> Actually, this is the classic problem of the contrapositive:
> 
> (!(a == 0 && b == 0))) ==  (a != 0 || b != 0)
> 
> So there was a logic bug.
> 
> Warner

DeMorgan is rolling over in his grave.  :)

-Nate



More information about the cvs-src mailing list