-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chuck,

On 5/24/2011 5:28 PM, Caldarale, Charles R wrote:
>> From: Christopher Schultz [mailto:ch...@christopherschultz.net] 
>> Subject: Re: Control character in cookie value or attribute
> 
>> On 5/24/2011 5:09 PM, Dan Checkoway wrote:
>>> -        } else if (CookieSupport.isHttpToken(value) &&
>>> -                !CookieSupport.ALLOW_HTTP_SEPARATORS_IN_V0 ||
>>> -                CookieSupport.isV0Token(value) &&
>>> -                CookieSupport.ALLOW_HTTP_SEPARATORS_IN_V0) {
>>> +        } else if (!CookieSupport.ALLOW_HTTP_SEPARATORS_IN_V0 &&
>>> +                CookieSupport.isHttpToken(value) ||
>>> +                CookieSupport.ALLOW_HTTP_SEPARATORS_IN_V0 &&
>>> +                CookieSupport.isV0Token(value)) {
> 
>> Ooh... looks like that expression could use some parentheses, too.
> 
> Doesn't absolutely require them, but...
> 
> I have a chart of C operator precedence on my wall; it's on two
> pages, and if I have to look at the back side of the sheet to figure
> it out, the expression should have parentheses.  && and || are on the
> back side...

Yeah, my rules for operator precedence have always been, loosely:

Do not use parent (unless necessary) for these operators:
   . -> ! ^ unary-

In expressions where the operators are unambiguous due to standard
mathematical expectations ( * and / versus + and -), parens are not
necessary.

In logical (boolean) expressions where all operators are the same (like
lots of && or lots of ||), no parens are necessary).

Everything else should use parens.

In Java, like C, && binds tighter than ||, which means that when Dan
switched the first two expression elements, he did not change the
meaning of the expression.

Dan, including parens in your patch would be a good thing :)

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk3cLYwACgkQ9CaO5/Lv0PABlQCgtqFj8HqEFB+mSHzThSLxdbqb
a4wAn1Xvwb9jDfrTIx7ECAx+t6+jK+sC
=Dqcw
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to