在你看来,你遇到过的最令人惊讶、最怪异、最奇怪或最“WTF”的语言特性是什么?
请每个回答只回答一个特征。
在你看来,你遇到过的最令人惊讶、最怪异、最奇怪或最“WTF”的语言特性是什么?
请每个回答只回答一个特征。
当前回答
“Piet是David Morgan-Mar设计的一种深奥的编程语言,他的程序是位图,看起来像抽象艺术。”
打印Piet的程序
其他回答
c#中的“动态”。
因为智能感知、类型安全和决定论会随着“动态”关键字的第一次使用而立即消失,因此所有必须与RAD或python受害者一起工作的人的日子都被毁了。
我一直想知道这个函数在Java Core库的Math类中的用途:
static double expm1(double x); // Returns e^x - 1.
JavaScript日期全是WTF。
var d = new Date("1/1/2001");
var wtfyear = d.getYear(); // 101 (the year - 1900)
// to get the *actual* year, use d.getFullYear()
var wtfmonth = d.getMonth(); // 0
// months are 0-based!
从技术上讲,WTF不是一种语言,而是一种架构。
http://www.6502.org/tutorials/6502opcodes.html#JMP
6502总成,间接JMP:
注意,间接跳转没有进位,因此: 间接跳转绝对不能使用 从最后一个字节开始的向量 一页的 例如,如果地址$3000包含$40,$30FF包含$80,$3100包含$50,JMP ($30FF)的结果将是控制权转移到$4080,而不是你想要的$5080,即6502从$30FF获取地址的低字节,从$3000获取高字节。
因此,在代码中添加一个字节可能会使间接跳转偏离目标。
PHP对字符串中数值的处理。详见之前对另一个问题的回答,但简而言之:
"01a4" != "001a4"
如果你有两个包含不同数量字符的字符串,它们不能被认为是相等的。前导零很重要,因为它们是字符串而不是数字。
"01e4" == "001e4"
PHP doesn’t like strings. It’s looking for any excuse it can find to treat your values as numbers. Change the hexadecimal characters in those strings slightly and suddenly PHP decides that these aren’t strings any more, they are numbers in scientific notation (PHP doesn’t care that you used quotes) and they are equivalent because leading zeros are ignored for numbers. To reinforce this point you will find that PHP also evaluates "01e4" == "10000" as true because these are numbers with equivalent values. This is documented behaviour, it’s just not very sensible.