C++17 Optional Initializer Chaos
C++17 added optional initializers to if statements. Of course, since you can put declarations there, this lets you define classes in the condition of an if statement. if (struct { operator bool() { return true; } } b; b) { std::cout << "🙃"; }
A programming meme shows a dark-mode social media post explaining that C++17 allows declarations, including a local struct with a conversion to bool, inside an if statement. The joke is that this technically valid feature enables absurdly overcomplicated code, so the program prints an upside-down face as a reaction to the language's complexity.
social media post / публикация в соцсетиprogramming code / программный кодC++ syntax / синтаксис C++if statement / условный оператор ifstruct declaration / объявление структурыcomputer programming / компьютерное программированиеwhite text / белый текстdark background / тёмный фонupside-down face emoji / эмодзи с перевёрнутым лицом
- @ithueti / 1511 2019-10-25
- @right_wing_dev_squads / 2864 2021-11-08
- Type
- image
- Size
- 654×800 · 70.3 KiB
- Mood
- саркастичный, абсурдный
- Language
- en
- Added