Skip to content
DevMeme
6176 of 7590
Languages Post #6773 · source on Telegram

C++ and C Mock Rust's Elaborate Efforts to Recreate Their Native Undefined Behavior

Description

This is a two-panel meme using the 'Look What They Need to Mimic a Fraction of Our Power' format from the animated series Invincible. In the meme, the powerful character Omni-Man is labeled 'C++' and the character he is holding, Invincible, is labeled 'C'. In the first panel, they are looking at a snippet of complex Rust code displayed in a dark-themed editor. The Rust code uses advanced and verbose features like explicit lifetimes, mutable static buffers, and function names like `get_horrible_buffer_mut` and `use_after_free`, satirizing the lengths one must go to in Rust to perform memory-unsafe operations. In the second panel, Omni-Man (C++) is yelling the punchline at Invincible (C): "Look what they need to mimic a fraction of our UBs". The word 'UBs' replaces the original 'power', referring to 'Undefined Behavior,' a class of dangerous and unpredictable bugs common in C and C++ that Rust's design is meant to prevent. The joke is a deeply ironic take on programming language design, where C++ and C veterans sardonically frame their languages' notorious memory safety issues as a form of effortless, raw 'power' that Rust can only achieve through painstaking, explicit effort

Comments

83
Anonymous ★ Top Pick The sheer volume of Rust code required to intentionally trigger a use-after-free is an achievement in itself; in C++, we just call that 'Tuesday'
  1. Anonymous ★ Top Pick

    The sheer volume of Rust code required to intentionally trigger a use-after-free is an achievement in itself; in C++, we just call that 'Tuesday'

  2. Anonymous

    Rust devs: “hold my macro while I surgically expand this lifetime”; C devs: *forgets one free()* - boom, instant UB, zero build-time overhead

  3. Anonymous

    After 20 years of C++, you realize the real achievement isn't writing safe code - it's convincing management that the segfault in production was actually a feature request for 'dynamic memory reallocation with user-driven timing.'

  4. Anonymous

    Ah yes, the classic C programmer's flex: 'Our language is so powerful, we can corrupt memory in ways your compiler won't even let you compile.' It's like bragging that your car goes faster because you removed the brakes and airbags. Sure, Rust needs lifetimes, borrow checkers, and explicit unsafe blocks to achieve what C does with a simple pointer dereference - but that's precisely the point. When your language's greatest feature is the ability to shoot yourself in the foot at 3 AM on a Friday deploy, maybe it's time to reconsider whether 'undefined behavior' is really the flex you think it is

  5. Anonymous

    C++'s RAII fortresses barely chase C's UB demons, who deliver peak perf until they summon nasal hell at scale

  6. Anonymous

    C ships UB as a core feature; C++ emulates it with templates, RAII, and three sanitizers; Rust writes an essay in unsafe and black_box - then -O3 still decides your invariants were merely aspirational

  7. Anonymous

    Only C ships undefined behavior as a zero-cost abstraction; Rust needs black_box, lifetime acrobatics, and a thesis-length comment to reproduce the same 3am page

  8. @mrYakov 1y

    https://github.com/ladroid/CppBorrowChecker rust: looks what they need to mimic a fraction of out safety

    1. @purplesyringa 1y

      that's a runtime borrowck...

      1. @mrYakov 1y

        Yeah, that's the point, lol

    2. @TheFloofyFloof 1y

      It's funny that every time C++ tries to compete with rust's memory system it's either an optional flag that barely works or a library which barely works

      1. @theu_u 1y

        Or builtin semantic that requires phd to fully understand

    3. @NaNmber 1y

      😐

      1. Deleted Account 1y

        best version control system every developer must use🤣

      2. @ZgGPuo8dZef58K6hxxGVj3Z2 1y

        The fact that this is github

  9. @Johnny_bit 1y

    "Just write good code"

  10. アレックス 1y

    why does rust syntax make my head hurt

    1. @nwordtech 1y

      Insufficient troon points, that's normal for regular people

      1. @purplesyringa 1y

        please don't use slurs, thank you

    2. @ashit_axar 1y

      Probably you learned C/C++ first. 😂😂 Then every other syntax looks like a joke. look at Python for ex. It doesn't seem like a code. More like a pusedo-code. How does it even do something 😒😒

      1. @purplesyringa 1y

        okay that's enough telegram for today

      2. Deleted Account 1y

        no c and c++ are lovely, what about js?

        1. @ashit_axar 1y

          JS, C#, C3, D, Java and any other similar syntax that makes sense are way to go, just like old days people doing real thing...

          1. @ZgGPuo8dZef58K6hxxGVj3Z2 1y

            JS is a joke tho

            1. @ashit_axar 1y

              But writing code in it makes sense

              1. @ZgGPuo8dZef58K6hxxGVj3Z2 1y

                Writing plugins/mods YES. Writing good code NO

                1. @ZgGPuo8dZef58K6hxxGVj3Z2 1y

                  And injecting code at runtime

                2. @ashit_axar 1y

                  I'm not gonna write code in like Zig or Rust or you name it....

                  1. @ZgGPuo8dZef58K6hxxGVj3Z2 1y

                    Fuck rust

      3. @ZgGPuo8dZef58K6hxxGVj3Z2 1y

        By not mixing spaces and tabs /s

        1. @ZgGPuo8dZef58K6hxxGVj3Z2 1y

          Python is racist

          1. Sure Not 1y

            import racismsolver

            1. @ZgGPuo8dZef58K6hxxGVj3Z2 1y

              Missing dependency: racism v1.5

              1. Sure Not 1y

                import("https://m.my.mail.ru/music/artists/Johnny%20Rebel")

              2. @itsTyrion 1y

                import twitter

      4. @RiedleroD 1y

        "oh no my syntax reads too much like speech" like bruh that's the point, or do you want your language to be hard to read and write on purpose?

        1. @ZgGPuo8dZef58K6hxxGVj3Z2 1y

          I think its more qbout syntax thats expressive without reading. Yk like how modern humans took the arrow as a shape to suggest pointing somewhere

          1. @RiedleroD 1y

            …elaborate please?

            1. @ZgGPuo8dZef58K6hxxGVj3Z2 1y

              ()=>{} "take that and put it through this logic" { Looks like this is a block of something }

              1. @RiedleroD 1y

                I mean I guess, but the same can be said about python. I find it quite nice to have indentation actually mean something

                1. @ZgGPuo8dZef58K6hxxGVj3Z2 1y

                  Its kinda limited

  11. Deleted Account 1y

    Wtf. What a weird syntax

  12. @anonusernametg 1y

    I wish Rust never existed. It's so annoying

    1. @TheFloofyFloof 1y

      Found the c kernel dev

      1. @SamsonovAnton 1y

        ✔️ Linux = widest platform support ✔️ C = widest platform support ❌ Rust = several popular platforms only

        1. @TheFloofyFloof 1y

          widest platform support doesn't matter if half of the platforms are dead

          1. @SamsonovAnton 1y

            Not everything is dead (something is just emerging), but they may lack Rust at all, or lag significantly behind the upstream.

            1. @ashit_axar 1y

              They call Linux a successful failure 😂😂

              1. @ZgGPuo8dZef58K6hxxGVj3Z2 1y

                I hate that rust is now allowed in linux

                1. @ashit_axar 1y

                  Let me go one step further. I hate linux too. 😂😂

                  1. @ZgGPuo8dZef58K6hxxGVj3Z2 1y

                    I am jsut starting to move to lunix

                    1. @ashit_axar 1y

                      I miss myself back in 2012 thinking linux is gonna save the world. But now every Linux distros to me looks like the same with a different wallpaper

        2. @purplesyringa 1y

          Rust supports almost every target that LLVM does. Which means that by "C = widest platform support", you mean "GCC = widest platform support", which a) GCC's Rust frontend aims to resolve, b) those platforms do not ever work properly under GCC anyway

          1. @purplesyringa 1y

            not to mention that "Linux = widest platform support" is a dumb take, Linux is a platform itself, duh

          2. @qtsmolcat 1y

            Hand crafted assembly has even wider platform support :)

            1. @RiedleroD 1y

              widest platform support is using it as deco like I do with old graphics cards and stuff

          3. @SamsonovAnton 1y

            GCC and LLVM are not the only compiler frameworks in use, just like x86, ARM, MIPS, RISC-V, POWER and zSystems are not the only CPU architectures in use [that run Linux]. And even if they were the only compiler frameworks, one still needs to port each specific compiler frontend to the target CPU architecture. not to mention that "Linux = widest platform support" is a dumb take, Linux is a platform itself, duh "Platform" really means a combination of CPU and OS. So, in context of Linux as ta specific Os, "platform" refers to CPU architecture.

            1. @deadgnom32 1y

              wow wow. you used "compiler frontend". my respect.

            2. @purplesyringa 1y

              I mean, okay, can't argue with that logic

        3. @RiedleroD 1y

          linux depends on rust nowadays

          1. @endisn16h 1y

            thankfully it doesnt

            1. @RiedleroD 1y

              it literally contains rust code

              1. @endisn16h 1y

                has a config opotion to support modules written in rust != depends on rust

                1. @RiedleroD 1y

                  sure you can cripple linux if you want. there's just a lot of stuff that's not gonna work if you do

                  1. @endisn16h 1y

                    false dichotomy

                    1. @RiedleroD 1y

                      speak without using jargon of a field you don't understand

                      1. @endisn16h 1y

                        this literaly is false dichotomy, not only do you equate not building MODULE with "crippling" linux, you also factually wrong about "this magical lot of stuff" that "not gonna work" how's linux was before they added rust support then?😅 lots of stuff weren't working? im so glad Linus went back on rust devs and purged the code from impertant places, leaving it to only reside in modules

                        1. @qtsmolcat 1y

                          its almost like stuff got rewritten or otherwise updated, y'know?

                        2. @RiedleroD 1y

                          linux before they added rust support didn't support some newer hardware that now builds on the rust subsystem. I also hear they've refactored some internals, but I'm not sure if that got blocked by the C squad or not real world example: afaik linux won't work at all on M1 macs without rust, just because some essential drivers are written in rust

                          1. @RiedleroD 1y

                            anyway, I still don't see how this has anything to do with a false dichotomy as you call it

                          2. @SamsonovAnton 1y

                            Then it's a Mac users' problem — not the rest of the world. Just like closed-source Nvidia drivers (which therefore cannot be ported to other platforms — both in the sense of CPU and OS) are a problem for Nvidia users only.

                        3. @purplesyringa 1y

                          source?

                          1. @purplesyringa 1y

                            nvm i just remembered i don't care

        4. @ZgGPuo8dZef58K6hxxGVj3Z2 1y

          C only wins because of signatures/symbols are use everywhere. Maybe its C++ idk don't remember

    2. @deadgnom32 1y

      I wish engineering never existed, so we could just live in wooden houses and drink ayahuaska to talk to the spirits. but I'm forced to talk to the machine spirit and fix legacy code

    3. @purplesyringa 1y

      me when I'm in a most ridiculous take competition and my opponent is @anonusernametg

    4. @endisn16h 1y

      real

    5. @sysoevyarik 1y

      if you think rust is annoying, just remember about rust users

      1. @anonusernametg 1y

        Double annoying

  13. @callofvoid0 1y

    wtf is this piece of shit

    1. @ZgGPuo8dZef58K6hxxGVj3Z2 1y

      Rust

      1. @callofvoid0 1y

        It's too much work for a simple skill issue

        1. @ZgGPuo8dZef58K6hxxGVj3Z2 1y

          Fr

Use J and K for navigation