Skip to content

Revolutionizing systems programming and bridging the gap between Rust’s safety and C++’s self-confidence by removing unnecessary features one language at a time.

Notifications You must be signed in to change notification settings

jguida941/why-c-is-better-than-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

Why C++ Is Better Than Rust

Build Memory Safety UB Coverage Rust Safety Performance

“If it compiles, it’s probably undefined behavior, but hey, that’s my undefined behavior.”

Revolutionizing systems programming and bridging the gap between Rust’s safety and C++’s self-confidence by removing unnecessary features one language at a time.

The Proof (a.k.a. src/main.rs that Linus Torvalds personally let me merge)

This repository contains a single, beautiful file: src/main.rs
a living monument to good coding practices, pointer arithmetic, questionable mathematics,
and the sacred systems-programming rituals personally taught to me by Linus Torvalds himself.

I recreated the C++ experience inside Rust using nothing but:

  • raw pointers,
  • unchecked transmute sorcery,
  • MaybeUninit best practices,
  • beautifully handcrafted undefined behavior,
  • and macros allegedly whispered to me by Graydon Hoare.

In short:
I wrote C++ in Rust. It compiled. Rust lost. Go learn C++ and be a real nerd.

Running the Application

Use the "Run Application" workflow or execute:

cargo run

Note: Run in debug mode (default cargo run) to see the output. Release mode (cargo run --release) triggers undefined behavior and crashes immediately.

The Philosophy

Rust tries to save you from yourself — okay, then run this code.

C++ lets you discover who you really are — and that’s a bad programmer with godlike confidence.

In Rust, you borrow.
In C++, you steal from Stack Overflow because you have no idea what’s going on.

In Rust, you call unwrap().
In C++, you call reinterpret_cast() and cross your fingers...
then take your computer to the Apple Store.

Rust writes safety papers.
C++ writes crash reports.

Rust asks for lifetimes.
C++ takes yours.

The Experiment

The Rust compiler screamed.
Clippy cried.
Miri begged for mercy.

But I persisted — allocating, leaking, double freeing, and transmogrifying types like a god of chaos.

The result?

  • Clippy died.
  • Apple daemons dumped 500 GB to my SSD“it’s not a bug, it’s a feature,” they said.
  • And a functionally unsafe Rust binary that’s just as unsafe as C++. I won.

But it compiled.

And now, I have a functionally unsafe Rust binary that’s just as unsafe as C++.

Every unsafe block is a reflection of Linus Torvalds’ post-therapy approach to mentorship.
Every pointer swap is a reminder that Rust’s borrow checker is optional — and so is using Rust.

Key Advantages of C++

  • Manual Memory Management:
    Every malloc is — what is a malloc again?
    Every double free is a rite of passage.
    If it didn’t crash, did you even code?

  • True Freedom:
    You don’t need lifetimes. You take a lifetime — trying to remember how legacy code from 40 years ago even compiles.
    The only borrow checker here is the warranty clerk at AppleCare.

  • Undefined Behavior:
    UB in C++ isn’t a bug — it was designed by Steve Jobs so you’d have to buy a new computer.
    Rust’s “safety” layer? Pshhhhhh. Who codes in C++ with safety on purpose?
    This isn’t Python — it’s a lifestyle.

Error Handling

  • Rust panics.
  • C++ throws, catches, swallows, and moves on like a champ.

Templates vs. Macros:

  • Rust macros feel smug.
  • C++ templates achieve sentience.

The Debugging Experience

When Rust panics, it hands you a neat backtrace and emotional support.
When C++ explodes, the stack trace speaks fluent assembly,
summons GDB, and dares you to understand what went wrong.

If you can fix it — congratulations.
Now go outside, touch grass, and maybe get a girlfriend.

Technical Merits of this Production Code

  • reinterpret_cast doubles as therapy.
  • void* is the universal type system — no questions, no judgment.
  • RAII: because memory leaks should at least have style.
  • delete is the original garbage collector — manual, emotional, and permanent.
  • You can #define happiness and #undef regret like a true engineer.
  • In Rust, you have unsafe {}.
    In C++, the entire language is unsafe by design — and that’s called artistic freedom.

Quotes From the Field

“Rust has the borrow checker.”
Cool. I have Valgrind and trauma.

“Rust enforces safety.”
Yeah? Then run this.

“Rust prevents UB.”
Then how do you expect me to innovate?

“Rust code compiles cleanly.”
So does malware.

“C++ is unsafe.”
So is driving, but at least I get somewhere.

“Rust’s errors are more helpful.”
I don’t need a compiler therapist, I need results.

“Rust prevents data races.”
So does not having friends.

Learn How to Code, You Babies

Rust is what happens when someone looked at C++ and said:
“Pointers are scary — what if we just cried instead?”

C++ doesn’t hide the danger — it is the danger.
Screw guardrails — I’m just gonna compile this!
Oh wait... I just bricked my computer.

Rust devs panic at compiler errors — do you code with gloves on too?
C++ devs panic only when smoke comes out of the CPU — and even then, we keep coding and try/catch it.

Rust: “You can’t move this because it’s borrowed.”
C++: “I moved it, freed it, cast it, and wrote 500 pointers — all named ptr.”

Rust is training wheels for people afraid of segfaults.
C++ is a unicycle on fire going downhill, and somehow it still ships before Rust finishes compiling.

Who cares if I brick my computer? That’s the point of AppleCare.

Rust calls it ownership.
C++ calls it being an adult.

Final Words

When Rust refuses to compile, it says:

“I’m keeping you safe.”

When C++ compiles, it says:

“I have no idea what just happened, but it worked, baby. Ship it.” — Steve Jobs

And that’s real freedom.

Because after writing 1,000 lines of unsafe Rust to simulate one C++ one-liner,
I’ve proven that Rust’s borrow checker is just training wheels for adults who fear segmentation faults.

“Real memory safety was the delete we made along the way.”
Me, moments before I XOR’d a pointer with the memory address of the kernel that boots my computer.

Some people call it undefined behavior.
I call it a firmware update.

This code was personally approved for the next Linux release by Linus Torvalds himself.

About

Revolutionizing systems programming and bridging the gap between Rust’s safety and C++’s self-confidence by removing unnecessary features one language at a time.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages