directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felix Knecht <fe...@otego.com>
Subject Logical Operators '&' vs Conditional-And Operator '&&'
Date Fri, 04 Jun 2010 09:46:22 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

To me it would look more logical use everywhere conditional operator
'&&' in the if restriction [1].

I don't think it's a false positive of findbugs
"NS: Potentially dangerous use of non-short-circuit logic
(NS_DANGEROUS_NON_SHORT_CIRCUIT)

This code seems to be using non-short-circuit logic (e.g., & or |)
rather than short-circuit logic (&& or ||). In addition, it seem
possible that, depending on the value of the left hand side, you might
not want to evaluate the right hand side (because it would have side
effects, could cause an exception or could be expensive.

Non-short-circuit logic causes both sides of the expression to be
evaluated even when the result can be inferred from knowing the
left-hand side. This can be less efficient and can result in errors if
the left-hand side guards cases when evaluating the right-hand side can
generate an error. "

[1]
http://people.apache.org/~felixk/shared-docs/xref/org/apache/directory/shared/ldap/schema/syntaxCheckers/UuidSyntaxChecker.html#85

PS:
Hope there's still enough coffee left ;-)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.15 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkwIy24ACgkQ2lZVCB08qHFYDgCePA6XE35v7gLoyhMUVAWeOILR
jjgAnA+CIdT9Ot856YW3h9Huxl0fhgdO
=K9BW
-----END PGP SIGNATURE-----

Mime
View raw message