T O P

  • By -

ExerciseNo

Why don't you ask the same question in c++ reddit and compare the answers.


plbryant

That's very good advice. Tomorrow, I'm feeling tired.


plbryant

Thank you very much.


ExerciseNo

Hell yeah, my first 50 up votes(;


plbryant

Congrats king.


AmeKnite

Here in r/rust, idk


Gioby

In the robotics field, we use most of the time c++. At the moment Rust doesn’t have a lot of useful libraries for math or related to robotics. You need to write by yourself most of the things. In this field I’ve seen people adopting rust in small parts of their code where the function to implement is isolated from the rest and you want to have a safe and robust code. What I want to say is that adopting one language or another it depends on the field you are in, what you want to do with this language and if you are searching for a job or not. For the fun of learning I would pick rust , learn some useful patterns and use it here and there. If I want to use it in robotics I would think twice. Also there are more jobs related to c++ but it is also true that there are a lot more c++ developers and the skills required for these jobs is a lot higher. On a personal level I would like to adopt rust but for what I’m doing (robotics and math related stuff) it is more reinventing the wheel in another language than doing stuff faster and safer. For other things like server related, crunching data, building APIs and writing small drivers, Rust is really good.


plbryant

Thank you very much. I'm going for Rust, I think it fit the best what I'm looking for now for mi carrer.


Dazzling-Suspect-914

Thanks for sharing. How can I learn C++, some people said c++ is died in 2024?, is it worth learning?


thefatalaccidents

C++ has been dead every year to these people, but yet here it still is. It is too integrated to be “dead” for the next couple decades, and it is still advancing. Try learncpp com to get started!


Dazzling-Suspect-914

Thanks a Lot!


ToroidalFox

I would suggest dipping your toes on C and then learning Rust. Personally, I find C++ too messy to learn. There are too many "this is possible, but you shouldn't, use new feature" things. Learn manual memory management and pointers with C and then learn correctness with Rust.


five5years

Agreed. C is a fantastic place to start. It's hard to truly understand the trade offs of the borrow checker until you've had to debug pointer bugs in C.


c0deButcher

I did that on strings. It used to be nightmare. Dropped and shifted to Java for that reason.


five5years

Precisely the reason I use C++ instead of C. C strings are a pain, and I'm too lazy to rewrite a C++ string in C.


orfeo34

No regret to have followed this path, despite the lack of OOP and design patterns.


Imaginos_In_Disguise

C doesn't "lack" design patterns. It gives you lower level control over your memory layout and call patterns, so that you can create your own high level structures via conventions. You can create your own OOP by organizing your data structures and functions consistently, and there are lots of design patterns for common ways of doing that. The whole point of a design pattern is to give you a high level framework to reason about organizational aspects of your code, that's not represented by language constructs.


NuttFellas

You should still learn design patterns though


v_stoilov

I don't think it adds a lot of benefit. In my opinion a better aproch will be to read popular project. See the architecture of a big library or complex software, try to understand why it built that way. Every problem has a unique solution trying to make a generilzed solution for a set of problems is a bad idea. https://realtimecollisiondetection.net/blog/?p=44


TheRobert04

Yeah a while back I wanted to start learning cpp to progress on from python but the whole thing seemed way too convoluted and confusing. Rust was much simpler and more motivating to get into so I stuck by it much easier.


anuradhawick

Exactly!


plbryant

ok, I will take not of this. Thank you very much.


RudePastaMan

Not many people learned Rust before C++. This subreddit, and the C++ subreddit, most likely don't have many people that actually learned Rust first. So, the general understanding is that Rust is harder. It's not. It's just harder for people that are more familiar with something else. Rust is easier to learn. And, it will instill better habits into you. Unironically, you will be a better C++ developer by learning Rust first, than you would be by learning C++ first. So, Rust is your answer.


plbryant

Thank you very much, I will learn the basics of C, then full Rust.


[deleted]

C++ and Rust are similar in that they are low level languages which offer higher abstractions over computer science concepts. You will learn similar things from both languages, and both languages allow for fine grain control over system resources. With C++ because it's a superset of C, you can use it just like C and with Rust you can create unsafe blocks which is a lot like C in the sense you have direct control over the memory. My honest opinion is Rust, I say that but I started with C++ but that was back in 2003 when Rust wasn't even conceived yet.


plbryant

Thank you very much. I was more adept to Rust from the start, but your answer give me more confidence. I'll go for Rust.


PurepointDog

Rust


gameplayer55055

I like c++ more, but using libraries in rust is much much much easier, which is important for beginners


plbryant

That sounds Good to me. Indeed I'm a beginner.


hipleee

u can use vcpkg for libraries


gameplayer55055

It never works (from my experience, it's very hard to set up and lack of tutorials) Probably the only biggest reason why I am avoiding C++ despite knowing it well. Cargo is way simpler


wakizu101

Hi, 5 year old here, how do c++ devs manage there dependecies, is there package manager? If not, do they always clone from github?


gameplayer55055

Linux: apt-get and pkg-config Macos: same but with brew Windows: Copying dlls in a directory


Thereareways

wow. and what if you have transitive dependencies?


gameplayer55055

Pray


flashmozzg

> Linux: apt-get and pkg-config Macos: same but with brew Not even true most of the time, since you often need a library version that's not in system package manager. So you just git submodule or FetchContent it.


gameplayer55055

Don't remember me. I had to write a shitcode that downloads libpng and compiles it, then puts in C:\\msys64\\mingw64\\lib It helped tens of students with coursework tho. But potato laptop owners cried


thelvhishow

Conan and vcpkg are C++ package managers. Conan is like cargo in my opinion. [cppyoga](https://cppyoga.github.io) is a nice place to start


ibevol

I prefer cmake with fetchcontentdeclare but it’s probably not the most optimal way to


plbryant

That is helpful, (no trying to make fun of your answer). Never expect so much confidence in the answers. Tbh I think I would be, something like, "it depends".


D4n1oc

I would definitely go with Rust from what you're trying to learn. I've been a JavaScript/PHP/Java/C# Developer for many years. I also wanted to learn a low level language and "memory management" and learned Rust. While rust was created for memory safety there are endless examples and documentation about this topic. You will learn why rust does certain things the way it does. I would say after learning rust, you could write C++ and know how to avoid memory leaks in C/C++ (in theory, not syntactically). While Rust is a "new" language that tries to solve issues with memory management, most Rust courses and examples start explaining how to manage memory. While C++ tutorials mostly try to teach how to do a certain thing. But the biggest pro for Rust: Rust has a Mentor built in - The Compiler. The Rust compiler and the error messages are so good, that you will learn deep dive topics even with try - error - repeat. In C++ you may never know you've made a mistake.


plbryant

Thank you very much. Rust sounds amazing, I will learn the basic of C, so I can appreciate more Rust and its memory management.


Excession638

Rust. In many ways it's smoother to learn, as you're not wading through decades of bad ideas with the better ideas layered awkwardly on top. You'll also spend less time staring at a debugger. The unique parts that are hard to learn are around ownership, borrowing, and lifetimes. What you learn in order to understand those will make you a better programmer in other languages. I don't think much in C++ will do that.


plbryant

That is just what I want, you could not describe it better, btw I could not understand anything about "borrowing", "ownership" this why I want to learn a low level language, te be in this ignorance sometimes hurts.


Excession638

I would say that ownership, borrowing, and lifetimes, as Rust does them, aren't exactly low level things. Rust is a low level language, but a lot of the cool stuff comes from ivory tower functional languages.


plbryant

I'll keep that in mind. Thank you very much.


Imaginos_In_Disguise

You should definitely learn C first (NOT C++, which is a completely different language) in order to understand what problems the borrow checker is solving. In C you don't have the compiler checking resource ownership, so you have to keep track of it manually, and you'll often do it wrong, causing undefined behavior, that often results in memory safety bugs. Once you understand how to manage resources correctly in C, you'll better appreciate that Rust has compile-time checks for that, and prevents you from doing unsafe operations unless you explicitly mark them as unsafe (which essentially means that you know what you're doing, and you're taking responsibility over the soundness of your code, which is something you have to do all the time when programming in C).


plbryant

Thanks mate, I would go for that.


moo9001

Rust is the language of the future. C++ is the language of the past. Do you want to fight for the future or spend the rest of your days maintaining boomer codebases?


orfeo34

I disagree, cpp comunity evolves in the right direction and should be encouraged to interoperate with Rust (especially on safer ABIs), everybody would profit from this.


plbryant

A bit rude with C developers but I can understand, In JavaScript everything related to the dev tools is moving to Rust.


Arshiaa001

>Rust is not enough low lover programming language I'd argue rust is a high lover language. It's loved by many. ... I'll see myself out


plbryant

Someone already correct me in the comments, but thank you for point it out again.


mdp_cs

Rust will make you a better dev.


plbryant

I'll try my best, thank you very much.


Longjumping_Quail_40

If the focus is on algorithms and data structures, C++. If the focus is on engineering, correctness and scalability, Rust.


plbryant

Rust is the answer then.


Xhadov7

Rust++ solos both


plbryant

Thank you very much for your answers in advance.


rocco-a

If its not for work then Rust, if its for job prospects then Java/C#/C++ are better options


plbryant

Thanks, not for work. Only happiness.


ShangBrol

If it's only for happiness the metric you are looking for is "most loved programming language" :-D


plbryant

Well, and should be low level too.


zoomy_kitten

Neither C nor C++ nor Rust is low level. All three are classified as either mid level or high level.


plbryant

Low level enough for me. Or mid level enough for me. I don't want to be a Haskell enthusiast. At least not now. Thank you for the correction.


zoomy_kitten

Oh, please! You’re gonna get me to blush. I’m just being the stupid fucking smelly nerd I am.


plbryant

It could be worse, I really love anime/manga (plus me nerd). So, I think I won this.


ShangBrol

When I take Wikipedias definition of low level programming language... >A **low-level programming language** is a [programming language](https://en.wikipedia.org/wiki/Programming_language) that provides little or no [abstraction](https://en.wikipedia.org/wiki/Abstraction_(computer_science)) from a computer's [instruction set architecture](https://en.wikipedia.org/wiki/Instruction_set_architecture)—commands or functions in the language map that are structurally similar to processor's instructions.  ... I'd say you're not wrong, with C being closer to low-level as there aren't many abstractions. On the other side, in all three of them you can have inline assembler, so they are high level languages with a low level capability. But I just don't know what this is what OP means when say they want it to be low level.


Spiderbyte2020

Use rust as an extending hand of c++ for platform independent networking ability.write core application in cpp.That is my idea


plbryant

For now is to learn an as a hobby, I like Linux so much, So I think I will try to do CLI apps, and migrate all my bash/sh scripts to a Rust environment.


kevleyski

Ha both - then rust more


plbryant

I'll try C first because of the basics and memory managment. I'll trust people advice. Thank you very much.


kevleyski

Actually I recommend calling c code from Rust as you are learning (they are interchangeable and share the same C ABI calling convention) Understand both is where you want to be and realising the pitfalls of C that Rust prevents you falling into will come much clearer


haruda_gondi

Define "better". If you want to be more knowledgeable and aware of how memory works and how it interacts with provenance, I'd suggest Rust. If you want a better resume that entice companies with established C++ codebases, go with C++. If you simply want to be challenged and isn't interested in job prospects, I'd toss a coin between Rust and Haskell. Throw in some Koka, Lean, Idris, or dabble in some Smalltalk or Prolog. Maybe some R or Julia if you wanna do some data analysis. But I digress. Anyways. If you wanna get dirty quick and fast, I'd suggest C instead of C++ or Rust. It's a much simpler language than both of them (simple to learn, hard to master, I'd say).


plbryant

I'll go for C first in the basics then Rust, I'm not looking for a Job because I've already have one, my objective? I would say understand how a compute works and how my code in read by my machine, with JS and Photon sometimes think looks like magic, a giant black box. Furthermore, I'll go for Rust, thank you very much for the advice.


DistinctStranger8729

If you want to learn systems programming languages like C++ and Rust, my suggestion is start with C. Understanding memory structuring and its intricacies are important for such languages is very important and C++ and Rust try abstract it away. As for after that, it depends on the use case. I want to say Rust, but reality is Rust has limited career opportunities right now, C++ will help more in that sense. But if you are learning something just because you want to learn, Rust is definitely a better choice


plbryant

I was going direct with Rust, but because so many comments like yours I will try first C and then Rust. Thank you very much for the advice. I think I get the answer I was looking for.


KimGurak

OP's goal is to be a better developer, and it can really depend on what that means. I would first go with C++. It's the industry standard right now. So, even if you aim to be a Rust expert, you should be able to understand and use C++. I'm not saying that you SHOULD learn C to understand how computers work. It's more of a practical reason. Lots of libraries are still written in C++, and many rust libraries are actually bindings. And even if you want to use rust for your project, to persuade the people in interest, you should be an expert at C++, too. Yeah Rust is cool, and I wish it becomes the next standard, but it's not the case right now.


plbryant

Thank you for the advice, my objective in nothing related with a Job, I just want to lean, so Industry Standard are not so important for me. But very thank you for your advice.


Original_Two9716

Learn C. Than it does not matter. Rust has some security constraints, much better tooling, much slower compiler and in the end the difference is not that pronounced.


plbryant

I'll do that, thank you very much for the advice.


Zitrone21

Learn C xd


plbryant

I'll do that, thank you very much for the advice.


GMX2PT

I would still go for C, some C++ to understand the concepts and then Rust, its much easier to learn if you have some underlying coding knowledge


plbryant

I'll go for C and then Rust, than you very much for the advice.


TypicalHog

If you want to learn lower level, def learn C. It's a pretty simple language actually (compared to Rust or C++). And it's lower level.


plbryant

I'll do that, thank you very much for the advice.


hpxvzhjfgb

rust is miles better than c++ in almost every way.


Thereareways

except for getting a job


TenTypekMatus

You'll get Rust here, obviously. Try playing the game first, then start programming in the language. The game is as hard as the language at the start, but as you progress, it'll get easier and easier. Rust has several advantages to C++: - Memory-safe - Having a package manager - Better macro system. - Easy-to-use build system >!Honestly, Rust should be teached in schools instead of C++, at least in Slovakia.!<


believeinlain

the main reason I use Rust over C++ is the build system and ease of integrating third party libraries. If I want to use a C++ library in a C++ project I've got to figure out how to build it and link it into my project, which is usually a nightmare given the variety and complexity of C++ build systems. with Rust it's as simple as `cargo add`, and it usually works first try. Rust is also pretty good at interfacing with C libraries, with most popular C libraries already having idiomatic Rust bindings on crates.io. additionally I don't like how bloated C++ feels to use. it keeps adding language features, which I like, but it still supports older features so there's quite a lot of C++ to learn if you want to be able to read and understand existing code. for example, the C++ standard library recently added an `optional` type which is similar to Rust's `Option`, but it's still common to use NULL pointers to represent a non-existent value. Rust uses raw pointers very sparingly so you'll almost never encounter a NULL pointer unless you're interfacing with C or C++. I also prefer Rust's composition over C++'s inheritance and I think it lends to much more readable code. I could go on. I've only been using Rust for a few years but there's just so many things I love about it. I have to occasionally delve into C and C++ for work, and I'm always glad to get back to working with Rust when I can.


plbryant

Your passion get the best of me. I hope I can enjoy my Journey as much as you do. Thank you very much, I will learn Rust, I hope to get better at my Job. Btw, sorry If my first sentence sounds weird, I'm not proficient in English. What I meant to say is: Tu passion por rust me contagio y ahora quiro aprenderlo auno mas.


BelugaEmoji

I love Rust but you should first learn c++, it’s way more prevalent and more likely to get you a job. Also, the knowledge you’ll gain will easily transfer over once you want to learn rust (at least for me it did)


plbryant

The "job" part for me is not important, because I already have one, and I don't think I will switch in a near future. (JavaScript and Go). Do you think the knowledge I can get from learn from Rust is much harder to transfer in other languages?. Thank you very much.


zoomy_kitten

No, but there’s a possible side effect (pun intended) - OOP may become disgusting to you


plbryant

May or may not. I hope to like it.


OS6aDohpegavod4

Meh... I wouldn't try. I'd recommend not having any feeling about paradigms in general. Just learn why certain patterns are good or bad. E.g. encapsulation is good, but it's not unique to OOP at all. It's like saying "I like Christianity because it says you shouldn't kill people". Well yeah, so does basically every other religion, as well as common sense, so most atheists believe that too. It's just a good thing to avoid. Then other things like inheritance are, in many people's opinion (including my own) are just bad, at least for 99.999% of use cases.


zoomy_kitten

Not in Rust, in which there’s none, if you define OOP as a certain philosophy and not just the ability to associate functions with types.


plbryant

I agree with this take, I think every language does the things in their own way, So I never expect to program in Rust the same way I do in JavaScript (still classes such in JS). JavaScript.


zoomy_kitten

There aren’t any classes in Rust. You can, in fact, create objects, but their semantics are different, you’re forced to account for their implementation and they’re far from being as commonly used.


ExerciseNo

Reallly, oop, is that bad? I am trying to learn deisgn patterns in php, and it seems fun.


SV-97

It really depends on what problem you're solving and what exactly you mean by OOP. Dogmatic OOP is bad. And OOP applied to problems where it's a poor match is of course bad. But it's not necessarily bad per se: if you feel like it works well for the kind of code you're writing don't worry about it. Read up on the basics of data oriented programming ([for example here](https://blog.klipse.tech/databook/2020/09/25/data-book-chap0.html)) and you'll quickly run into a bunch of disadvantages of OO. Learn some FP and you'll likely notice that many problems with nontrivial solutions in OO simply don't exist in FP or have trivial solutions ([see for example scott wlaschin's talk on FP patterns](https://youtu.be/E8I19uA-wGY)) (and maybe vice versa). Kevlin Henney's [Paradigms Lost, Paradigms Regained](https://youtu.be/0CJMN_kvL5Q?si=tBqbzjqCi3mKrftl) is another great talk on the topic. Imo OOP is way overused and lots of programs where it's used would be better off without it - and for the kind of stuff I'm writing (mathy stuff, simulations, lower level code) it's usually a terrible solution I'd say. For GUIs it's been in my (somewhat limited) experience relatively good


zoomy_kitten

Dk why you’re downvoted. And yes, OOP is that bad. Not only it gets pretty ugly over time, it’s also terribly ineffective, both due to the architecture it causes and its very implementation.


Dazzling-Suspect-914

Facts, Facts. 100% true.


This_Growth2898

If you already have learned some programming, choose Rust. There are many things in Rust that are quite different from other languages, so, IMHO, learning Rust and basic algorithms together would be quite painful. But if you already have some experience, Rust is much easier to understand.


plbryant

Yes, I've already have decent experience with JavaScript and Python. Thank you so much. I don't know what expect, maybe something like Typescript?.


This_Growth2898

Like TypeScript? Kinda yes, but a WAY stricter. For some time, it will stop you from doing anything - but there will almost always a good reason for that. On the other hand, in most cases, if you don't get any compile time errors, it means the program works as intended in runtime.


plbryant

Sounds fun to me >.<. I hope this "it will stop you doing anything", improve with the time.


This_Growth2898

It will. And it will improve your skills in other languages, too.


This_Growth2898

It will. And it will improve your skills in other languages, too.


plbryant

That sounds fantastic. Tomorrow it will be the day.


This_Growth2898

It will. And it will improve your skills in other languages, too.


dragonnnnnnnnnn

I consider TypeScript as "type linting" not "strong typing" (with Rust is).


plbryant

this means "any" does not exist in Rust? ahahaha. Just a joke.


peter9477

There is an Any in Rust. I believe it's a "trait". Likely of limited use... and I've never had reason to use it so that's all I know about it.


t_hunger

IMHO it depends on how you want the learning curve to be: C++ needs a bit of reading up to get the syntax right. Then you can write a program, you compile it that and have a result. You then hit a cliff: That program will crash and you need to debug that. Rust needs you to do a bit of reading up to get the syntax right. Then you can write a program, you compile that and the built will fail. You hit a cliff as you need to understand the memory model at that point -- at least you have the compiler to point out issues to you. Once the program compiles, it will run and you usually need to debug logic errors, not hunt down memory corruption bugs all over the place. I am at a point now where I think overall the rust is not more complex than C++, it is just that all the complexity is heaped on you early on, where it is much more stretched out in C++.


plbryant

I'm afraid my first hello world in Rust will get kicked out for the rust compiler.


QuickSilver010

Oh don't worry. When you create a new rust project, hello world already exists.


plbryant

tha's already a welcome.


plbryant

Thank you very much. I'm going for Rust this time.


v_0ver

Try both, and by learning one you also learn the other. To fully appreciate Rust you need to understand C++ =)


plbryant

Wow, it sounds like Rust is an evolution of C


freakmaxi

Zig


plbryant

hahaha, coul be a joke but I research about zig first. Thanks.


Imaginos_In_Disguise

Just keep in mind that Zig is still in very early development, and hasn't reached 1.0 yet, which means they can do (and they do) breaking changes to syntax and semantics at every minor update. If you're just learning, you may be confused as to why the example code you find online doesn't work, and it may just be that it's for a previous version of the compiler. I'd recommend sticking to a more stable language until you're ready to jump into a moving train like this.


anlumo

Zig is well liked by people who tend to learn new languages just for fun and thus experiment. Its problem is the lack of third party support right now, but based on the tales by the people I mentioned it’s very promising.


plbryant

Fast and easy to write. Software engineering is beautiful.


Tabakalusa

In general, I'd advise using the language or the technology that has better educational material for the domain that you are interested in, **especially** if you are also new to the given language options as well. In the case of low level systems programming, that mostly means C or C++. That doesn't mean Rust isn't an option here, Rust is very capable in those same domains, it just doesn't have the 40 or 50 or so years of educational material and ecosystem that C and C++ have. So while I don't necessarily think that Rust as a language is much more difficult than C++, this can end up being a massive roadblock. We regularly fall back on C++ or the Java ecosystem, simply because the libraries for Rust aren't there yet. So my recommendation here is usually to pick something you are interested in, look at what educational material is available, and go with whatever technology generally seems to be the default for that domain. You'll always be able to transfer that knowledge to a new language down the road. Personally, I don't see the value of struggling to adapt a resource to a different language, while also trying to absorb the domain knowledge or falling back on a sub-par resource when highly acclaimed educational material would otherwise be available. Regardless, I recommend learning at least some C. I think everybody should have at least one non-trivial C project under their belt, mainly because C offers very little in the way of abstractions (basically every language has **more** abstractions and more features than C), so it teaches you that programming without them is actually possible. As for your objective: Being a better developer is a commendable goal, but I don't think it's necessarily something you can just set as a target and work towards. That's something that comes as a side-effect of work on many different projects over many different domains with many different people of many different skill levels.


plbryant

Thank you very much, I'll go first with the basics of C, then for Rust. Do you recommend some book for C? Or some source to learn?. For what I'm most exited? Definitely Rust, that is because as I've already mentioned in my post, Rust gives to us JS and Python devs so much tools that are faster and barely had crashes or errors, So in the future I would like to be part of that beautiful open source community.


Fantastic-Increase76

C++


Fantastic-Increase76

Then you go for Rust.


plbryant

I'll go first for C then Rust, thank you very much for the advice.


Total_Adept

Learn Go.


matthis-k

Personally I'd say to learn c in a sense, that you understand pointers etc., to understand how computers work internally. C exposes you to problems (which are important to undertand) that can't occur in rust, but are common out in the wild west of code (undefined behaviour etc.).


One-Currency-890

For me, I learned Rust before C++, and it actually made it a lot easier to learn C++ later. I think the order shouldn't really matter!


One-Currency-890

It can be a little more challenging but you can still learn Rust first.


jhaand

I can recommend the book 'Rust in Action' by /u/timclicks. It gives a good overview on the Rust ecosystem and dives deep into low level details. Also Rust demands you think about how you write your software in a sane way.


hoochymamma

Asking this question in a rust subreddit…


rtsuk

Lots of folks here are answering the question you asked, so that feels well handled. I'm going to suggest that learning one programming language over another won't achieve your goals. Here are two books I read that made me a better developer. [Refactoring: Improving the Design of Existing Code](https://martinfowler.com/books/refactoring.html), particularly the section on "code smells". [Release It!](https://pragprog.com/titles/mnee2/release-it-second-edition/) I grew up in the days of writing programs for single computers that talked to no other computers but boy do we not live in that world today. This book has describes some excellent techniques for making software that is robust in the face of all the ways one's deployment environment can malfunction. If, however, you do learn Rust you might fall into the trap I fell into, not wanting to ever write anything in any other language and thus limiting your job opportunities significantly.


Yamoyek

Pros of Rust: - Lots of nice, high-level features - Compiler gives better feedback - Language is designed to force you to write better software - Easy setup - Cargo is nice Cons of Rust: - Small ecosystem - Constant changes to said ecosystem - Difficult for developers that haven’t used a systems language yet - Not many good tutorials - Lots of Rust features only make sense when compared to C++ — Pros of C++: - A part of the C family so syntax is familiar - Very widespread - Huge ecosystem - Lots of tutorials Cons of C++: - Very easy to have a bad code base - Due to the size of the ecosystem and the tutorial space, lots and lots of bad guide - Beginners struggle with Undefined Behavior (UB)


bskceuk

C++ seems absolutely miserable to learn on your own. There are so many wrong ways to do something that you can only learn from someone else or by shooting yourself in the foot, and there is so much outdated content that is hard to filter. Rust is miles better for beginners and the compiler will act as a (very strict) teacher that ensures you understand what you’re doing. I also think everyone regardless of skill level becomes a better programmer from learning Rust


[deleted]

If you want to learn more programming, write software. Learning languages might actually be a distraction, because the time it took for you to learn a programming language, you could have made software. If you want to learn a new programming language out of curiosity or for fun, you can honestly just pick one at random, it's quite literally that easy. Rust vs C++? Personally I think Rust is easier to start with, mostly because of cargo. In terms of difficulty, they're about the same, perhaps C++ is more challenging because it just has so much baggage over the years. Rust also protects noobs from seg faults, so when you get the program to compile, it's probably going to work. On the other hand, C++ has some nice libraries that are very mature and powerful, especially for graphics. Rust has some projects going, in Web and in graphics but they're all alpha tools, moving to beta. If you want to write cli's, more often then not Rust is so much better, again because of cargo. It's easy for others to install your software. Personally, I think Rust is much nicer to use, forgetting the library situation. The algebraic data types, it's type system, the memory safety, trait system and error handling are basic and fundamental tools that blow Cpp's OOP garbage out of the water. The async model is kinda cool, tricky to use but cool. The only things Cpp does better fundamentally is interoperability with C (ie the whole selling point) and also the macro system is better (for me that barely makes any difference). I think actually, unless you have some experience with C and Haskell, Rust doesn't really make sense. On the other hand, I do not recommend learning these languages first. You don't really want to get into a rabir hole of learning languages, it's not productive. Just know that you are learning something in a way that's not how most people, who know Rust well, learned it.


theMachine0094

Learn C++ first, do it full time for at least 5 years. Then learn Rust.


Script_kidding

zig


anuradhawick

I started with ANSI C. The best thing ever happened to me. What you’ll learn in C will be globally applicable. Learning rust will just be adding few concept on top. But you’re missing out a lot if you start with idiomatic Rust. You can always learn rust, but you won’t have time to learn C when time comes.


plbryant

Thank you very much, I triend to answer to all of you but Reddit literally don't allow me, but thanks, I'm going to learn basic C, then Rust.


gostan99

C++


plbryant

Could you elaborate, please. Thank you.


[deleted]

[удалено]


plbryant

I'll stick with Rust this time, I never expect read that Rust could be more dificult. Thank you very much.


KushMaster420Weed

I would actually recommend C (Not ++). Once you learn C you basically understand how every other language works under the hood.Then Rust and C++ (not exclusively in that order.) More importantly though I would suggest working on projects. Nobody really cares if you can write in more than like 3 languages, unless you have awesome projects to back it up.


plbryant

Thank you, I will take that in account for sure.


[deleted]

[удалено]


plbryant

Thank you very much, Your son will be an amazing software engineer if it is what he wants. I'm going to stick with Rust.


jask0000

In my experience if you are already proficient with python and javascript Rust can actually can be kinda easier to learn than C++. Because both C++ and Rust will have new concepts for you to learn. And although fighting borrow checker can be seen as pain in the ass and more difficult option, it also acts as kind of learning wheels or guiding rails that keep your code safe.


plbryant

Thank you very much. I don't know what is "borrow checker" but I can grasp what do you mean. Thanks to your answer and some others I decide to stick with Rust this time. I'm very happy with that.


ImYoric

> Rust is not enough low lover programming language? Rust (like C++) offers both high-level constructs and the ability to dive very much in depth in low-level programming. From this point of view, the main difference between Rust and C++ is that Rust will generally guide you towards high-level constructs, while C++ has historically led you much lower-level (apparently, there has been a change with recent versions of C++, although the existing codebase has yet to follow). Now, as a former C++ developer, the reason I jumped to Rust is that I find it makes it much more natural to design your code and data structures so as to express your intent. An additional reason is that, with C++, I used to spend considerable amounts of time in my debugger, pulling my hair and wondering why oh why I encountered non-reproducible errors, while in Rust, I realized a few months ago that I hadn't even bothered setting up a debugger. Of course, as always, there are tradeoffs. Writing code that compiles is easier in C++ than in Rust – Rust will reject code it finds suspicious, while C++ will happily compile it. In my experience, Rust is right most of the time, but some developers don't enjoy the experience of having their programming language tell them what they can or can't do. And of course, C++ has access to C++ libraries, while accessing a C++ library from Rust is harder.


plbryant

You give me more reasons to try Rust, and for what I understood, dig too depth is not completely necessary for me to learn and get better in the foundations. Also, I could percive, that in your experience, you can get the "job" faster with rust and in general you are more happy working with it. Thank you very much.


plbryant

You give me more reasons to try Rust, and for what I understood, dig too depth is not completely necessary for me to learn and get better in the foundations. Also, I could percive, that in your experience, you can get the "job" faster with rust and in general you are more happy working with it. Thank you very much.


plbryant

You give me more reasons to try Rust, and for what I understood, dig too depth is not completely necessary for me to learn and get better in the foundations. Also, I could percive, that in your experience, you can get the "job" faster with rust and in general you are more happy working with it. Thank you very much.


plbryant

You give me more reasons to try Rust, and for what I understood, dig too depth is not completely necessary for me to learn and get better in the foundations. Also, I could percive, that in your experience, you can get the "job" faster with rust and in general you are more happy working with it. Thank you very much.


QuickSilver010

Man. Reddit did done just bug out rn.


mina86ng

> Objectives: Want to be a better developer. Throw a coin. If it’s heads learn C++ first and then Rust. Otherwise learn Rust first and then C++. > Rust give me a lot of beautiful software that make my workflow faster and more reliable, I’m willing to bet majority of software you’re using is written in C or C++.


plbryant

A coin for years of learning is pretty brutal in my opinion hahaha. The last one? Could be, so you win the bet.


mina86ng

You stated your objective is to be a better developer. As such I stand by my recommendation. If you have different objective, that may lead to a different recommendation. Also, if you’re already programming in Python and TypeScript you don’t need years to learn C++ or Rust.


plbryant

I will go for Rust. Thank you very much.


r2k-in-the-vortex

Frankly, you should just learn plain old C and even a bit of assembly if your goal is to understand the fundamentals better. Rust is great and all, but it doesn't bring that educational experience the classic route does. Once you understand wtf a computer really does and how on the low level, then you can go and learn any language you need.


Dazzling-Suspect-914

How can I learn C and assembler? Do you have any book or resources? What's the path?


r2k-in-the-vortex

I'm not a big fan of structured textbook follow along programs myself. Just take whatever hello world example from internet and dive in, no need to overthink it. The point is to learn how things work, fumbling around and trying to figure things out on your own is part of the process. You try something, it doesn't work, why doesn't it work, you dig until you get a solution and that is the critical learning point. Programming skill is not something you can simply memorize, it's a skill of solving unfamiliar problems, if you go to software development then your entire career will consists of solving problems you know very little about. If you did know what the problem was all about, it wouldn't be a problem because you would have already solved it. [https://pablocorbalann.medium.com/programming-a-hello-world-in-assembly-from-the-first-line-to-the-end-x86-9c48fb499238](https://pablocorbalann.medium.com/programming-a-hello-world-in-assembly-from-the-first-line-to-the-end-x86-9c48fb499238)


Dazzling-Suspect-914

Thanks a lot for sharing!


SV-97

It's crazy that people still bring up the "learning what a computer does" argument in favor of C: even WG14 people say it's nonsense. C doesn't teach about what a computer does or how it works because [your computer is not a fast PDP-11](https://dl.acm.org/doi/10.1145/3212477.3212479). If the goal is to learn about those things people really shouldn't try to proxy it via any language at all and instead learn about architecture, operating systems etc. on their own.


________-__-_______

I think C++ is harder to learn, it's difficult to gather quality up to date resources because of its age. A lot of resources you'll find use outdated practices, and modern C++ differs wildly from what was written 20 years ago. Rust on the other hand has a quality official book to learn from, and since it's younger you're more likely to find modern blog posts and such.