Geoff Thorpe wrote:
On Friday 30 May 2008 09:52:40 Ben Laurie wrote:
Dr. Stephen Henson wrote:
I do wish you wouldn't use these extra brackets around comparison operators. if (len == -1 && !(attrtype & MBSTRING_FLAG)) works just fine and is consistent with most of the rest of the code, and the rest of the world.I find Steve's version more readable.
Agreed. Cleverness is not a virtue here, unless this is a programming contest. Very few programmers remember that &, ^, |, && and || have different precedence (and in the order in which I enumerated them) and which ones associate left-to-right versus right-to-left. When two expressions evaluate to the same value, a useful question to ask is: which version reduces the cognitive load on the reader by reducing ambiguity or error? - M ______________________________________________________________________ OpenSSL Project http://www.openssl.org Development Mailing List [email protected] Automated List Manager [EMAIL PROTECTED]
