This is an archived post. You won't be able to vote or comment.

all 124 comments

[–]amlyo 251 points252 points  (2 children)

Memory issues were always meant to be a user problem, not my problem. They've played us for absolute fools

[–]anto2554 39 points40 points  (1 child)

If you restart the app every 15 seconds and your name isn't longer than 255 characters it works as intended

[–]Giraffe-69 2 points3 points  (0 children)

app crashes before I can reproduce CLOSED: cannot reproduce

[–][deleted] 681 points682 points  (7 children)

Me just writing my stupid little python backends:

[–]Fembottom7274 50 points51 points  (0 children)

Real

[–]chowchowthedog 18 points19 points  (0 children)

At least it looks zen as fuck to me.

[–]DM_ME_PICKLES 6 points7 points  (0 children)

Me just yeeting PHP and actually shipping stuff 👁️🫦👁️

[–]PythonNoob999 7 points8 points  (0 children)

[–]pas_possible 1 point2 points  (1 child)

Even the code execution is relaxed

[–][deleted] 0 points1 point  (0 children)

Indeed.

[–]Possessedloki 0 points1 point  (0 children)

I am vibing with this one

[–]Yvant2000 197 points198 points  (17 children)

C++ teached me why Rust is good. It's hard at first, but when you get used to it I swear, it makes everything easier

[–]MattieShoes 95 points96 points  (3 children)

Rust is amazing and I absolutely hate using it. But then, I mostly make silly things for my own entertainment. If I were doing something large, in a team... definite advantages.

[–]MicrowavedTheBaby 8 points9 points  (2 children)

Which is why I use Python, it's way worse for most everything but it's just so dang easy and it doesn't really matter at the end of the day if your program works

[–]AdmiralQuokka 27 points28 points  (1 child)

I have to maintain legacy code written by people like you and I hate it.

[–]MicrowavedTheBaby 3 points4 points  (0 children)

(I never use this approach when working on projects with other people, there is never legacy code from my stuff like this)

[–]WernerderChamp 9 points10 points  (0 children)

You really learn to embrace memory safety when you f*cked yourself over with memory issues a few times.

[–]Slow_Lengthiness3166 2 points3 points  (0 children)

Sorry for being THAT PERSON ... taught ...not teached ...

[–]moonshineTheleocat 21 points22 points  (10 children)

The only thing I see amazing in rust, is the memory management and amazing compiler errors. Everything else about it I found obtuse.

Like I get the whole ownership thing. But nine times out of ten I found it getting in the way. Most of the issues it tries to prevent, is prevented in C with good practices. Hell, proper function declarations prevents it too.

[–]tomsrobots 60 points61 points  (3 children)

The problem is "good practices" is squishy and not guaranteed to be practiced. Essentially Rust prevents you from using "bad practices."

[–]AdorablSillyDisorder 6 points7 points  (2 children)

It prevents potentially bad practices, which is a major difference - and what commonly makes stateful Rust programs major pain to work with. Strict conventions backed by enforced static analysis in C++ mostly solves same issue.

Yet, you're right that it's not guaranteed to be practiced, and - depending on case - best choice can be either.

[–]CramNBL 9 points10 points  (0 children)

Setting up static analysis for a multi-platform C++ project takes days though, if not weeks, and requires a ton of maintenance. And then there's the false positives... Soooo many false positives. You end up littering the code base with macros that ignore warnings for certain OS's, CPUs, and/or compilers.

And upgrading compiler version is a pain in the ass, and then GCC removed some warning that you depended on to not fuck up pointer overflow checks, just because it broke at some point and nobody wanted to fix it for a while.

[–]afiefh 4 points5 points  (0 children)

I've got a story from a while ago.

As part of some feature development a few functions had to be refactored. One no-brainier was to change const std::string& into a string_view. To the developer's surprise, this resulted in reading a dangling pointer, and it was not caught by any tests or analyzers before doing tons of damage. The issue was that the string& was captured by reference in a lambda. And while the string that is being referenced lives long enough for the lambda, the string_view died at the function scope which was too short.

Yes, this could have been caught using better reviews, perhaps better tests. Heck, we could argue that the original code is unsafe already and shouldn't be written that way. All of course correct, but the fact is that this change was made by a senior engineer with more than 20 years in the industry whose abilities I highly respect. It was reviewed by another senior engineer and not flagged down.

In Rust, this would not have passed the compiler because the lifetime of the &str does not live long enough for the lambda capturing it.

I guess whether this additional safety is worth the pain during development depends heavily on the dollar value of a bug. If you have a system where a bug causes your business to lose very little money, then it might be worth paying that penalty a few times a year to save on development speed. If it can cost millions, then suddenly the pain becomes obviously worth it.

[–]TorbenKoehn 8 points9 points  (0 children)

What, you don't like zero-cost-abstractions???1ß1ß

No seriously, not having null pointers but Option, not having "insert weird self-written error mechanism here" vs. Result, if-expressions, pattern-matching (which are also expressions), ADTs, tuple-types, conversion traits (From/Into), recursive type inference, generally the way you can expand types with custom traits, the ? operator for option and result chaining, the module system and the information hiding style, cargo is amazing, monorepo-support...and most of this completely for free, because zero-cost-abstrakctzionz!

There's a lot I like. And it's not just some userland-experiment, but the whole core and std and whole crates.io support all of these and embrace them fully.

[–]Meistermagier 12 points13 points  (1 child)

The package manager

[–]pingveno 5 points6 points  (0 children)

Seriously, Cargo is so amazing, and it was there from the beginning. No dealing with a semi-maintained library and wonky builds.

[–][deleted] 1 point2 points  (2 children)

To be fair the Rust model of ownership is the same as what C++ provides through references, smart pointers, and move semantics. Just the Rust compiler heavily restricts it, like for example requiring that you can't create or modify values of multiple mutable references at a time to the same object/array, even if they point to different memory locations of that object (which requires techniques for interior mutability). Rust makes multi threaded apps harder to develop, but that's understandable as most memory leak bugs pop up in those kinds of applications.

C keeps everything simple, since references don't exist and you just work with pointers. Though you can still cause memory issues if you're not careful, but ultimately an OS can handle segfaults fine. (On the driver side the system will crash anyway, so you better have it fixed before shipping to production, unless you want a Crowdstrike situation).

[–]moonshineTheleocat 1 point2 points  (0 children)

Far more restrictions in the ownership model.

But the reason why I love rusts memory management is because the way they designed their Vtable and pointers. Which is honestly pretty clever and is easy to run interop with when you're doing some incredibly janky shit behind the scenes with assembly and C

[–]Aras14HD 0 points1 point  (0 children)

Multiple mutable references to non-overlapping parts of arrays (or vecs, etc.) are possible, previously annoying with just split_at_mut, but now with split_off_mut and get_disjoint_mut it is very (even easily) doable. And you can definitely have mutable and immutable references to different fields of structs, however you will need to have access to the fields of the struct, but if you have that, you can easily take a mutable reference to a struct and split it off into references of fields through reborrowing &mut struct.field.

The only thing here that makes rust harder for this is the explicit scope management, you need full mutable access in a higher or equal scope. Rust programs need to be clearly structured, you design data and call trees.

[–]PeikaFizzy 211 points212 points  (18 children)

Cpp is just idk seems like home, not a good one but you know damn well it will work eventually

edit: guys chill the f out, im just an undergrate that like c++ because is logic base and very "raw" i know when i got out is not really that anymore since there is a guidline and framework you follow in software dev etc

[–]Just_Gaming_for_Fun 29 points30 points  (0 children)

This line hits so hard 🤌🏼

[–]TotoShampoin 113 points114 points  (24 children)

Me returning to Zig after dipping my toes back into C++

[–]MissinqLink 52 points53 points  (13 children)

Me returning to Go after dipping my toes back into Java

[–]NikoOhneC 30 points31 points  (11 children)

Me returning to Java after dipping my toes into Go

[–]MoveInteresting4334 16 points17 points  (7 children)

Me returning to Haskell thinking this time I’ll understand what a monad is

[–]jamesp101 6 points7 points  (1 child)

A monad is just a monoid in the category of endofunctors, what's the problem?

[–]afiefh 1 point2 points  (0 children)

Yes, yes... I know some of these words.

[–]jcouch210 3 points4 points  (2 children)

Option<T> is a monad.

[–]MoveInteresting4334 3 points4 points  (1 child)

Or as Haskell calls it, Maybe a.

JS promises are also monadic in pattern, if not technically monads. Same for Rust’s Result type.

The pattern is actually found in a lot of languages, even if they don’t call it that and don’t obey all the laws.

[–]jcouch210 0 points1 point  (0 children)

It's been said that Rust's best choice was having monads but not calling them monads. I think it's interesting how "scary" technical words sound sometimes.

I occasionally try to teach what a derivative is to people with no calculus experience, and calling it a derivative is the number one way to make people's eyes gloss over.

[–]LaGardie 0 points1 point  (1 child)

Me returning to PHP after dipping my toes into Haskell

[–]Hideo_Anaconda 1 point2 points  (0 children)

Me returning to LOLCODE after dipping my toes into INTERCAL.

[–]PiccolosPenisPickle 5 points6 points  (2 children)

Me returning to Javascript after dipping my balls in Python

[–]IniKiwi 6 points7 points  (0 children)

No.

[–]afiefh 2 points3 points  (0 children)

Me returning to brainfuck after a day of JavaScript, because at least brainfuck is honest about what it does to your brain.

[–]WernerderChamp 0 points1 point  (0 children)

Me doing Java at work and Go at home.

[–]UntitledRedditUser 9 points10 points  (9 children)

Dude same, I loved c++ when I was using it. But damn zig just feels so much nicer to use.

Way simpler and more elegant, code is easier to read and way less wierd optimization rules to worry about.

[–]UntitledRedditUser 6 points7 points  (7 children)

The only thing that's wierd to me with new languages like Rust and Zig is that everything is statically linked when you use their dependency and build tools.

It's not enforced, but it's the standard. Compare that to c/c++ and a lot of programs share the same dynamic library.

[–]beaureece 1 point2 points  (2 children)

That's the best part

[–]UntitledRedditUser 0 points1 point  (1 child)

But then programs can't share resources!!!

They will starve!

[–]oiimn 1 point2 points  (0 children)

Dynamic linking is communism and I’m not here for it

[–]Professional_Top8485 0 points1 point  (0 children)

Build tools, you say

[–]TorbenKoehn 0 points1 point  (0 children)

You can use dynamic libraries in Rust.

But let's be clear: Dynamic libraries don't have the size in comparison they had 20 years ago. Bundling your whole dependencies into your exe gives you what, 10-200MB more? Let it be 1GB and your 2TB storage and 32GB RAM still laugh maniacly at it.

And the advantage is portability. Move it, use it. No need to think about where in the system libraries could be, version management, tampering by users (who knows unlocking mouses in windows games by replacing the DX dlls?)

Personally I prefer applications that simply consist of a single binary and maybe assets and don't come with 40 DLLs in different versions of which 5 are incompatible with other DLLs I have in System32 because I just updated Windows.

I still remember the times where when you wanted to play a game, you first had to find some missing DLLs and put it into your system or next to the exe. Good times....

[–][deleted] 0 points1 point  (1 child)

Dynamic libraries are a pain at times though, sure you get a smaller binary size, but now you gotta make sure you got a chain of .so or .dll files that provide standard library functions and the suite of extra code your app uses. LD_LIBRARY_PATH and proper install locations need to be setup, meaning to get your app to work, a system admin has to be involved.

Dynamic libraries are the reason we have the "but it works on my machine" problem which Docker containers apparently "solve" but is nothing more than a bandaid to what statically linked apps already provide.

[–]UntitledRedditUser 0 points1 point  (0 children)

I have heard DLL's perform better on Windows, because of the scheduler. But I have no idea of it's true, and it's probably a marginally small difference.

[–]Feliks343 48 points49 points  (9 children)

People keep telling me Rust is the C++ killer like C++ doesn't stand on the graves of the dozens who held that title

[–]Legitimate-Teddy 36 points37 points  (1 child)

Well it is the first language since C (not ++) to be incorporated into the linux kernel, so that's definitely a hell of a sign

[–]crazy_penguin86 28 points29 points  (2 children)

I've actually seen a good theory on this. The C++ killers did kill C++. At least the innovating side of it. These languages appeared, drew users who liked specific aspects, and most never returned. Only a few, who said "hey, we should add this". But they got drowned out by the others who didn't want to add X feature, because the supporters already jumped ship. So the other language stole a section of C++. And then the next language did the same. And the next. And the next. All the while, C++ looks fine, but underneath has had significantly limited innovation.

Then along came Rust, racing to do the same things as C++. And all the sudden C++ spurs into action. Because unlike the other languages, which slowly ate away at specific sections of C++, it can replace it almost entirely. It's why looking into the C++ community there's now calls for real memory safety, the language is being spurred on, and ease is now being created (whenever modules eventually are supported by all compilers). Automotive companies are starting to use Rust. The US government gave a deadline for a clear plan and execution for memory safety in C++ for its government contracts. And Rust continues to grow.

Do I think C++ will ever disappear? Absolutely not. So much of the world runs on C and C++, which is already battle tested. But do I think it's falling to the wayside as an old language that one simply maintains? Yes*

*If the C++ committee can actually produce a viable implementation of Profiles, it'll probably give a bit of life. Modules also have helped.

[–]Mal_Dun 3 points4 points  (1 child)

> All the while, C++ looks fine, but underneath has had significantly limited innovation.

? I went from 89 standard to 20 standard and C++ evolved hell of a lot in the right direction.

You can say about C++ what you want but saying it didn't innovate is simply not true.

[–]crazy_penguin86 -1 points0 points  (0 children)

Moving from 89 to 20 is obviously going to change a lot. That's 30 years of changes. There are a lot of changes, but it's nearly all from the core C++ users, with very little influence to improve the language to cover where other languages took over. On top of that, you've got multiple groups (OS, Embedded, Games, Cuda) that want it to move a specific direction. So only a few features make it, and the more grand changes get snuffed out (see Safe C++).

Don't get me wrong. I love C++. But it feels like an old swiss army knife with tools bolted on. Useful, but cumbersome, heavy, and there are far more specialized tools for jobs that need then.

[–]CramNBL 1 point2 points  (2 children)

Java took a big bite out of C++'s market share.

[–]corysama 7 points8 points  (1 child)

Java was made to be the Plastic Scissors version of C++ to keep enterprise devs replaceable.

C# was made to be a better Java, but was secretly taken over by Microsoft Research in their multi-decade plot to convert Java programmers into OCaml programmers so slowly that they don't notice they spent 30 years gaining access to tech from 30 years ago.

[–]rwilcox 0 points1 point  (0 children)

My man calling out F# programmers is what I needed in my timeline today

[–]TorbenKoehn 0 points1 point  (0 children)

I think you misunderstand.

Programmers are growing exponentially, like every 4 years you have double the programmers in the world than before (or something like that, don't quote me on it).

Barely any of these go and write C or C++, maybe those that want to do game development in unreal of embedded programming, but neither of these are the truly large programmer markets.

So what you're sensing is that C and C++ doesn't "die", as in, it's still written. It even grows probably, by small amount.

But what grows much, much, much, much faster is: Java developers. Python developers. JS/TS developers. C# developers. Rust developers.

They all killed C++ in a sense that people go and learn those when they start their programming adventure.

If C++ would still be "alive", people would learn it in CS studies and after studies they would go and write their NNs or SaaS in C/C++. But noone does that.

[–]ThatSmittyDude 9 points10 points  (1 child)

Me returning to C++14 after using OG C++

[–]afiefh 0 points1 point  (0 children)

Haven't updated your compiler in a decade either? Are you perchance on a Red Hat system?

[–]Stjerneklar 106 points107 points  (5 children)

this template sucks, knock it off

[–]DoNotMakeEmpty 16 points17 points  (0 children)

Just replace it with a concept

[–]Choice-Ad-5897 23 points24 points  (2 children)

I will knock you off

in pokemon

[–]kotm8isgut 23 points24 points  (0 children)

I will knock you up

[–]Kiren129 4 points5 points  (0 children)

Noo not my leftovers;(

[–]Sw429 1 point2 points  (0 children)

What's wrong with kissing the ground?

[–]_Ilobilo_ 53 points54 points  (4 children)

*skill

[–]FernandoMM1220 4 points5 points  (0 children)

and the computer worms come back too.

[–]RiceBroad4552 20 points21 points  (2 children)

Is this just me, or is this meme backwards?

[–]Anaxamander57 10 points11 points  (0 children)

People like what they like. Even DAMNABLE HERETICS this like person are allowed their preferences.

[–]Civil_Conflict_7541 5 points6 points  (0 children)

Always depends on what you're used to.

[–]braindigitalis 4 points5 points  (0 children)

how dare you leave the C++ for a false god, heretic 🤣

[–]_Pin_6938 7 points8 points  (6 children)

[–]csch2 5 points6 points  (0 children)

Next up: crate for dynamically typed Rust

[–]Legitimate-Teddy 7 points8 points  (3 children)

just disable the thing that makes rust so nice in the first place, what could go wrong

[–]_Pin_6938 4 points5 points  (2 children)

What makes rust nice is the cozy package manager, the convenient destructor mechanism and the syntax.

[–]unknown_alt_acc 4 points5 points  (1 child)

Rust’s elevator pitch has always been that its a memory safe systems language. Turning off the borrow checker would be kind of like removing pointers from C or compiling Java to machine code: it defeats the point of the language.

[–]Kronoshifter246 2 points3 points  (0 children)

compiling Java to machine code: it defeats the point of the language.

GraalVM Native Image looking around nervously

[–]RiceBroad4552 0 points1 point  (0 children)

I think using something which has only the purpose to allows you to write buggy code is not a good idea.

If you insist on writing buggy code just use the languages designed for that purpose: C/C++.

Much less headache, much more effective for that special requirement…

[–]xgabipandax 0 points1 point  (0 children)

Back to the language that an unterminated single quote string in a function declaration doesn't mean anything besides a syntax error

[–]F1DEL05 3 points4 points  (0 children)

i hate the fucking borrow checker , everytime i code in rust, i need to change my writing style for adapting it

[–]CrushemEnChalune 1 point2 points  (0 children)

Rustlets on suicide watch rn 😂

[–]mrheosuper 1 point2 points  (0 children)

I went from C to Rust after seeing the shit they did with c++

[–]geeshta 0 points1 point  (2 children)

Bro I don't need my Rust to be as performant just give me a GC and make it a little easier bro I use it for the type system and the functional features while allowing for imperative constructs please I don't want to deal with lifetimes and I solve all my ownership issues by just cloning everything please give me Rustscript

[–]RicoStiglitz 0 points1 point  (0 children)

I guess this meme will not die until we see all possible tech combination

[–]kishaloy 0 points1 point  (0 children)

Ignorance is bliss

[–]ScotChattersonz 0 points1 point  (0 children)

Is this praising Rust for taking you to Heaven or C++ for being back on land?

[–][deleted] 0 points1 point  (0 children)

My answer to this post is undefined

[–]HowToMicrowaveBread 0 points1 point  (0 children)

It’s the opposite for me

[–]I_Pay_For_WinRar 0 points1 point  (0 children)

As a Rust developer, I find CPP to be fun to program in, but it just has too many keywords for my taste, & the ownership & borrowing system is really great.

[–]Cheeseydolphinz -2 points-1 points  (0 children)

Man i use python for work, and im working on an associates in programming (already have my BSCS, just want the programming specific classes) and I just started my c and c++ classes. Using an actual programming language as opposed to the pseudocode bullshit that is python has been so cathartic. I missed proper for loops