[SAMBA 4] [PATCH] Fix IBM checker warnings

Zachary Loafman zachary.loafman at isilon.com
Fri Feb 8 16:28:04 GMT 2008


> Jelmer Vernooij wrote:
> :
> > "ret = ret && " is harder to read and write than "&=", and the
latter
> > should be considered correct too.
> 
> ...but not equivalent.  &= is a bitwise AND operation, which has the
> desired
> effect but it's not the same as the logical &&.

Agreed.

&= is not the same on a platform that doesn't support a real boolean
type. You run the risk that a test does something like:

uint32 foo;
foo = some integer result;
return foo;

Here, all the tester cares about is that foo is non-zero.

But now you get into the &=, and bitwise & will certainly treat this
differently. Yes, the correct form is really '!!foo', so maybe the test
creator was wrong. However, I very much agree with Mr. Kroeger that the
"&=" form is wrong, the IBM checker is not actually buggy here, and the
torture code should be fixed.

(As an aside, almost all of those tests should be converted to the
suite/tcase form so they can be run individually. That would render this
argument moot.)

...Zach


More information about the samba-technical mailing list