C++ Mental Gymnastics
C++ mental gymnastics strcpy() R mental gymnastics fn alloc_str(mem: &mut Vec<char>, s: &str) { ... } fn alloc_buffer(mem: &mut Vec<char>, size: usize) -> Ptr { ... } fn stretch(&mut Vec<char>, mut s1: Ptr, mut s2: Ptr) -> bool { ... } fn read_line_into_buffer(input: &mut impl BufRead, mem: &mut Vec<char>, buf: Ptr) { ... }
A simple C++ string-copy operation is shown as a relaxed exercise, while the Rust version turns memory management and string handling into an absurd gymnastics routine. The joke is that Rust’s safety and ownership rules make a trivial task dramatically more complicated. It is used as a reaction to overengineering or frustration with Rust code.
C++ logo / логотип C++Rust logo / логотип Rusttext labels / текстовые подписиwoman standing / стоящая женщинаwoman walking / идущая женщинаsmall burning car / маленькая горящая машинаroad / дорогаsidewalk / тротуарgymnast on parallel bars / гимнаст на брусьяхperson doing a handstand / человек, стоящий на рукахperson balancing on a platform / человек, балансирующий на платформеflying gymnast / летящий гимнастflames / языки пламениblack-and-white line drawing / чёрно-белый рисунок
- @profunctor_io / 8687 2023-02-24
- @dev_meme / 5214 2023-05-20
- @right_wing_dev_squads / 7897 2023-10-23
- Template
- Mental Gymnastics
- Type
- image
- Size
- 800×630 · 75.3 KiB
- Mood
- sarcastic, absurd
- Language
- en
- Added