language-history

Uppercase Booleans vs. Lowercase in PHP

廉价感情. 提交于 2019-11-30 10:19:52
问题 When I was learning PHP, I read somewhere that you should always use the upper case versions of booleans, TRUE and FALSE , because the "normal" lowercase versions, true and false , weren't "safe" to use. It's now been many years, and every PHP script I've written uses the uppercase version. Now, though, I am questioning that, as I have seen plenty of PHP written with the lowercase version (i.e. Zend Framework). Is/Was there ever a reason to use the uppercase version, or is it perfectly OK to

Why do C compilers prepend underscores to external names?

浪子不回头ぞ 提交于 2019-11-26 16:33:59
I've been working in C for so long that the fact that compilers typically add an underscore to the start of an extern is just understood... However, another SO question today got me wondering about the real reason why the underscore is added. A wikipedia article claims that a reason is: It was common practice for C compilers to prepend a leading underscore to all external scope program identifiers to avert clashes with contributions from runtime language support I think there's at least a kernel of truth to this, but also it seems to no really answer the question, since if the underscore is

What is the purpose of Java's unary plus operator?

狂风中的少年 提交于 2019-11-26 00:49:12
问题 Java\'s unary plus operator appears to have come over from C, via C++. int result = +1; It appears to have the following effects: Unboxes its operand, if it\'s a wrapper object Promotes its operand to int , if it\'s not already an int or wider Complicates slightly the parsing of evil expressions containing large numbers of consecutive plus signs It seems to me that there are better/clearer ways to do all of these things. In this SO question, concerning the counterpart operator in C#, someone