The evil demon Curse of the programming language

Source: Internet
Author: User
Tags lua


Incorrect re-assignment of true in Python 2 the pronunciation of two and true in English is rhyming, but it doesn't make any sense.

Fortunately, after Python 3, after the word true, false, and none as reserved words, repeated assignments can produce syntaxerror errors. But this strange practice is much less than you use #define true false in other people's standard headers.
Incredible performance in Java and Python languages
For Java programmers, the semantics of the "= =" operator is often confusing. However, even in trivial scenarios, the inconsistency of the operators can complicate the situation. Even this can improve the execution efficiency of the program.



The JVM will use the same reference between [-128,127]. Even more surprisingly, the Python language has the same behavior.



Even if it becomes negative, the result is the same.

In the same instance code, the lower bounds of the integer interval of the Python language interpreter appear to be-5. It's even more bizarre to get the same ID value for an integer range within [-5, 256].



It seems that using destructive assignment will change the existing rules. I don't know why that is, I actually ran into a stack overflow problem and tried to understand it. My guess is that the duplicate values in one list in memory point to the same object.
Anti-downward standard in C language
A reverse subscript will make any developer feel a headache.



The reason this writing works is that Array[index] is actually just the grammatical sugar of the * (array + index). Thanks to this interchangeable nature, we can swap the array name with its index to get the same result.
The "keep going" operator in the C language
The first time I saw the → operator, it seemed to be a grammatical error. When compiled, it looks like a feature of a language that is not archived. However, these ideas are wrong.



The operator → is actually two operators, and is resolved to (x--) >0 in the example given. As we all know, doing so in the production software will cause considerable confusion, extremely evil.
The sizeof operator in the C language
operator sizeof is a compile-time operator that provides interesting properties.



Because an instance of the sizeof operator is performed at compile time, the x+=1 is not executed. Equally interesting: studies have shown that printf ("WTF?") This line of code is the most typical case that will never be pushed into the stack.
Indexes for Lua, Smalltalk, Matlab, and more languages start at 1
/r/programmerhumor/This directory has a lot of indexes starting from 1 jokes. Surprisingly, the fact that many programming languages have an array index starts at 1.
The value of 0 in the Ruby language is True
...... And only the Ruby language.



Fixed: It was pointed out at the Reddit site that the same is true for Lua, Lisp, and Erlang languages.
Trigraph, digraph and token in C language
For historical reasons, there are alternative characters in the C language that are not alphabetic and non-numeric.



Some foreign devices, such as IBM3270, do not provide some of the symbols commonly used in C + +, and thus provide those digraph, trigraph and token, with the aim of not discriminating against specific character sets.

--------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.