x = (y + 1) % 10; x = (y + 1) * (z - 1); x = (double)(f(y) + 1); x = -~y % 10; x = -~y * ~-z; x = (double)-~f(y); | Syntax | Value | Mnemonics |
|---|---|---|
| - ~ y | y + 1 | Tadpole swims to value and makes him bigger |
| ~ -y | y - 1 | Tadpole swims away from the value and makes it smaller |
#define __ENABLE_EXPERIMENTAL_TADPOLE_OPERATORS #define __ENABLE_EXPERIMENTAL_TADPOLE_OPERATORS #include <ios> #include <iostream> #include <istream> int __cdecl main(int, char**) { int n = 3; std::cout << "3 + 1 = " << -~n << std::endl; std::cout << "(3 - 1) * (3 + 1) " << ~-n * -~n << std::endl; return 0; } -x = ~x + 1; -~x = ~(~x) + 1 = x + 1; ~-x = (~-x + 1) - 1 = -(-x) - 1 = x - 1; Source: https://habr.com/ru/post/258811/
All Articles