在你看来,你遇到过的最令人惊讶、最怪异、最奇怪或最“WTF”的语言特性是什么?
请每个回答只回答一个特征。
在你看来,你遇到过的最令人惊讶、最怪异、最奇怪或最“WTF”的语言特性是什么?
请每个回答只回答一个特征。
当前回答
我很惊讶居然没有人提到Visual Basic的7个循环结构。
For i As Integer = 1 to 10 ... Next
While True ... End While
Do While True ... Loop
Do Until True ... Loop
Do ... Loop While True
Do ... Loop Until True
While True ... Wend
因为粘!你面前的条件实在是太复杂了!
其他回答
我喜欢在C中插入八进制值:
int values[8] = { 123, 154, 103, 310, 046, 806, 002, 970 };
Algol通过名称传递(使用C语法说明):
int a[3] = { 1, 2, 3 };
int i = 1;
void f(int j)
{
int k;
k = j; // k = 2
i = 0;
k = j; // k = 1 (!?!)
}
int main()
{
f(a[i]);
}
我一直想知道这个函数在Java Core库的Math类中的用途:
static double expm1(double x); // Returns e^x - 1.
不知道它是否可以被认为是一种语言特性,但是,在c++中,几乎任何与模板相关的编译器错误都会每天向世界各地的许多c++程序员交付相当数量的WTF:)
通知7。一个有效程序的例子:
Chomsky is a room. A thought is a kind of thing. Color is a kind of value. The colors are red, green and blue. A thought has a color. It is usually Green. A thought can be colorful or colorless. It is usually colorless. An idea is a thought in Chomsky with description "Colorless green ideas sleep furiously." A manner is a kind of thing. Furiously is a manner. Sleeping relates one thought to one manner. The verb to sleep (he sleeps, they sleep, he slept, it is slept, he is sleeping) implies the sleeping relation. Colorless green ideas sleep furiously.
像图灵机模拟器这样的其他愚蠢的东西可以找到。