Is it ok to use ≠
instead of !=
. I know it's an extra alt code and I've never used this on a project but I've tested it out and it works. Are there any pros/cons besides having开发者_JAVA百科 to Alt +8800
.
Edit: I'm not going to use this, I just want to know. Tested language php.
You have not mentioned which programming language your question is about, but ≠
has a number of disadvantages:
It does not exist in ASCII. Code written in anything else but pure 7-bit ASCII is way too vulnerable to strange encoding errors and it forces unnecessary requirements upon the editing program. It might even be displayed incorrectly depending on the editor font etc, and you do NOT want that to happen when editing code.
Even if it does work, it is not widely used, which by itself is a good reason to avoid it.
It saves screen space, sure, at the expense of clarity. It might even be mistaken for an
=
if you are tired. Terse code is not always best.It cannot be typed easily in a portable manner. As a matter of fact, I don't know how to produce it on my Linux system without a graphical character selector.
Except for the screen space (disk space is actually the same or worse than !=
) I cannot think of any other "advantage", so why bother?
EDIT:
On my system (Mandriva Linux 2010.1) with PHP 5.3.4 the ≠
(U+2260, or 8800 in decimal) operator does not work. Are you certain that your editor does not implicitly convert it to !=
?
精彩评论