tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: How do I ........?
Date Wed, 15 Nov 2006 20:52:21 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

All,

Caldarale, Charles R wrote:
>> From: Steve R Burrus [mailto:burrus1@swbell.net] 
>> just a tiny correction for you Chris, and that is that the 
>> code ought to 
>> be "if(in = = null)" not as u had it "if(null = = in)". Am I 
>> right or not?
> 
> No, you're not.  The order of operands makes no difference for an
> equality test.  (And don't put spaces in the middle of operators -
> that's not what Chris wrote.)

My use of the 'null' argument first in equality checking comes from my
use of the C programming language. In C, this is a valid statement and
generally does not do what you want:

if(in = null)

In Java, this is a syntax error. (Note the single = sign, indicating
assignment, instead of a double == indicating comparison).

Since you get bitten in C by missing an equals (it's quite easily to
miss it visually), I got into the habit of putting the null first.

As Chuck points out, it's exactly the same thing. Oh, and you can't put
spaces between the equals signs, or the compiler won't recognize it as
the equality operator. The equality operator is "==". It is /not/ two
equals signs, contrary to popular belief. Spaces are simply not allowed.

Why the heck are we discussing things like this on a mailing list for an
app server!?

- -chris

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

iD8DBQFFW34F9CaO5/Lv0PARAl9TAKCrxUD0kgy+8CqsQulbl5TRNzuC2gCgjjEa
Gi0vYdQJ4gp3B5uE+YyzFJE=
=2zBd
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message