
>>> True = False >>> True False SyntaxError in Python version 3, since True, False and None are now reserved words . Such a prank is still far from being mean in C ++ when you insert #define true false into the standard header file on a co-worker’s machine.== semantics often perplex beginner Java programmers, but even more complicates the situation by the inconstancy of the operator, even in trivial situations, even if it is for performance. Integer a = 100; Integer b = 100; System.out.print(a == b); // prints true Integer c = 200; Integer d = 200; System.out.print(c == d); // prints false [-128, 127] . What is even stranger is the appropriate behavior of Python. >>> x = 256 >>> y = 256 >>> x is y True >>> x = 257 >>> y = 257 >>> x is y False  >>> x = -5 >>> y = -5 >>> x is y True >>> x = -6 >>> y = -6 >>> x is y False -5 . Integers in the range [-5, 256] get the same ID. But still it works somehow strange. >>> x = -10 >>> y = -10 >>> x is y False >>> x, y = [-10, -10] >>> x is y True  int x[1] = { 0xdeadbeef }; printf("%x\n", 0[x]); // prints deadbeef array[index] is actually just syntactic sugar for *(array + index) . Thanks to the commutative property of addition, you can swap them and get the same result.--> operator looks like a syntax error. But when you understand that it compiles normally, you start thinking that this is an undocumented function of the language. Fortunately, this is neither. for (x = 3; x --> 0;) { printf("%d ", x); // prints 2 1 0 } --> - these are actually two operators, which are understood in this context as (x--) > 0 . It is known that such a thing causes considerable confusion when used in production - pure evil.sizeof in Csizeof operator is processed during the compilation process, which gives it interesting properties. int x = 0; sizeof(x += 1); if (x == 0) { printf("wtf?"); // this will be printed } sizeof operator are analyzed during the compilation process, the expression (x += 1) will never be run. Also curious: studies show that printf("wtf?") Is the most popular line of code that never goes into production.true in Ruby if 0 then print 'thanks, ruby' end # prints thanks, ruby | Trigraph | Symbol | Digraph | Symbol | Token | Symbol | ||
|---|---|---|---|---|---|---|---|
| ??= | # | <: | [ | %:%: | ## | ||
| ??/ | \ | :> | ] | compl | ~ | ||
| ??' | ^ | <% | { | not | ! | ||
| ??( | [ | %> | } | bitand | & | ||
| ??) | ] | %: | # | bitor | | | ||
| ??! | | | and | && | ||||
| ??< | { | or | || | ||||
| ??> | } | xor | ^ | ||||
| ??- | ~ | and_eq | &= | ||||
| or_eq | |= | ||||||
| xor_eq | ^= | ||||||
| not_eq | != | 
 if (true and true) { // same as if (true && true) printf("thanks, c"); } Source: https://habr.com/ru/post/345690/
All Articles