在你看来,你遇到过的最令人惊讶、最怪异、最奇怪或最“WTF”的语言特性是什么?
请每个回答只回答一个特征。
在你看来,你遇到过的最令人惊讶、最怪异、最奇怪或最“WTF”的语言特性是什么?
请每个回答只回答一个特征。
当前回答
ANSI SQL中空值的三值逻辑。
其他回答
c++最恼人的解析:
struct S
{
S() {} //default constructor
};
int main() {
S s(); // this is not a default construction, it declares a function named s that takes no arguments and returns S.
}
Perl充满了奇怪但整洁的特性。
If可以用在语句之前或之后,就像这样:
print "Hello World" if $a > 1;
if ($a > 1) { print "Hello World"; }
foreach也是如此:
print "Hello $_!\n" foreach qw(world Dolly nurse);
C++:
void f(int bitand i){ //WTF
i++;
}
int main(){
int i = 0;
f(i);
cout << i << endl; //1
return 0;
}
在Ruby中…
i=true
while(i)
i=false
a=2
end
puts defined?(a) // returns true
叫/ cc。Call/cc将一个表示程序其余部分的函数传递给程序体。