在你看来,你遇到过的最令人惊讶、最怪异、最奇怪或最“WTF”的语言特性是什么?

请每个回答只回答一个特征。


当前回答

在SQL server(至少MS)中:

这将总是求值为false:

IF @someint <> NULL

考虑到:

DECLARE @int INT

SET @int = 6

IF @int <> NULL
BEGIN
    Print '@int is not null'
END
ELSE
BEGIN
    Print '@int is evaluating to null'
END

输出将是:

@int is evaluating to null

必须这样写:

IF @someint IS NOT NULL
BEGIN
END

谁让英语专业的人加入了SQL队!:)

其他回答

A very tiny thing that annoyed me in COBOL was that there was no dedicated modulo operation. Instead you could do a division specifying that you only wanted whole number results and store the rest in a different variable. Since COBOL is very sensitive when it comes to variables that means that you ended up with a variable you didn't really need, i.e. the actual result of the division. This is the story of how I once named a variable "USELESS" - that was the most appropriate name I could think of.

在Ruby中,0在条件表达式中求值为true。

这让我惊艳

#define _ -F<00||--F-OO--;
int F=00,OO=00;main(){F_OO();printf("%1.3f\n",4.*-F/OO/OO);}F_OO()
{
            _-_-_-_
       _-_-_-_-_-_-_-_-_
    _-_-_-_-_-_-_-_-_-_-_-_
  _-_-_-_-_-_-_-_-_-_-_-_-_-_
 _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
 _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
 _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
 _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
  _-_-_-_-_-_-_-_-_-_-_-_-_-_
    _-_-_-_-_-_-_-_-_-_-_-_
       _-_-_-_-_-_-_-_
           _-_-_-_
}

Forth可以随时改变数字的基数:

HEX 10 DECIMAL 16 - .
0 Ok

它也不需要是预定义的:

36 BASE ! 1Z DECIMAL .
71 Ok

在MAXScript中,所有操作符都是平等对待的。因此,a = b +c使a等于b,然后计算a+c的和,并丢弃结果。