What additional concepts should I learn before starting to learn rust? - c/Rust

8 months ago by andioop to c/learn_programming

Someone once told me somewhere, that if I am trying to learn rust, I should learn C first, so that I know how to shoot myself in the foot, learning to avoid doing so, so that the borrow checker of rust doesnt seam to unforgiving (since you somewhat know, what happens if you dont follow best practices). So thats what I did (somewhat) for the past 6 months. I wrote some stuff in C, but mainly I had quite of a deep dive into operating systems (mainly linux), working mechanics of memory and the CPU and a lot more (I will try to make a list of the stuff I learned and the ressources used below). My question to you is, if there are any additional concepts/things I should learn beforehand, to start learning rust. The (somehwat complete) list of things learned for the past 6 months: - Stack Behaviour (Why its so fast, what its used for,â€Ļ) - The heap (why its useful, but dangerous) - Theoretical Concepts of threading (Concurrency vs. paralellism) - Theory of race conditions (how and why they occur, and some tricks to avoid them) - Concepts of Memory allocation on an OS level (Address Spaces) - System calls and the separation between kernel and user space - Signals - Basics of Inter-Process-Communication - CPU-Scheduling (CPU-/IO-Bursts, context switches, different scheduling algorithms up to ROund RObin (based on complexity)) - How loops, conditions and function calls get implemented in Assembly / how the CPU performs these - Bitwise Operations I probably forgot a significant part of the stuff I learned, but its quite hard turning it into a list, without writing a whole book, and trying to remeber everything. Most of these things are mainly theory, since I havent gotten around to code that much in C. However I definitively have some experience in C. This includes on how to handle pointers, basics of handling the heap, strings (even if I absolutely hate them in C) and some system calls (I played around with sbrk for custom memory management without malloc). The ressources I used for learning is primarily the YouTube-Channel CoreDumped [https://www.youtube.com/channel/UCGKEMK3s-ZPbjVOIuAV8clQ] (I highly recommend), LowLevel [https://www.youtube.com/channel/UC6biysICWOJ-C3P4Tyeggzg] and some other ressources, but these were the most helpful ones. So, feel free to send me down my next rabbit hole before starting rust.

I feel this post had pretty good answers in the replies, and figured it's a post people learning programming might want to see.

trevor 7 points 8 months ago

The fact that people treat Rust like it's very difficult is odd to me. I write Rust because C was too hard. Lol.

I tried to learn C, but once the learning materials got into double pointers and void pointers, I stopped being able to follow it. So I went back to Rust and after about a month of practice, I no longer struggle with the borrow checking rules (usually the hardest thing for people new to Rust) and it just keeps getting easier over time.

If you know C, you're probably more than well prepared for Rust.

path: 0 22027795, hotness: undefined, score: 7, children: 1
nous 1 point 8 months ago
path: 0 22027795 22028887, hotness: undefined, score: 1, children: 0
nous 6 points 8 months ago

Someone once told me somewhere, that if I am trying to learn rust, I should learn C first, so that I know how to shoot myself in the foot, learning to avoid doing so

This is stupid advice. If you want to learn rust then learn rust.

So thats what I did (somewhat) for the past 6 months. I wrote some stuff in C

In that time you are no closer to learning rust. If you started with rust you would know it by now. Rust is not harder to learn then C. If anything C is harder to learn as it's compiler doesn't guide you at all.

You don't need to learn C to appreciate the borrow checker. I find beginners just accept whatever they are first taught. It is only really those that come from C the put up a bigger fight when learning rust.

And 6 months in a language without a borrow checker is not really long enough to learn the reasons why a borrow checker is useful. Not without a good guide that focuses on that. Which most c books don't. The best way to learn it is with rust that actually tells you when you mess up.

path: 0 22028896, hotness: undefined, score: 6, children: 1
xtools 1 point 8 months ago
path: 0 22028896 22051151, hotness: undefined, score: 1, children: 0
6nk06 5 points 8 months ago

if I am trying to learn rust, I should learn C first

Bullshit. I learned C++ instead of C and I don't regret it. One step further and you should learn assembly, or the electronics powering the computer. Learn whatever you want.

path: 0 22027083, hotness: undefined, score: 5, children: 0
learn_programming
learn_programming

@programming.dev

login for more options
2254
161
53

Posting Etiquette

  1. Ask the main part of your question in the title. This should be concise but informative.

  2. Provide everything up front. Don't make people fish for more details in the comments. Provide background information and examples.

  3. Be present for follow up questions. Don't ask for help and run away. Stick around to answer questions and provide more details.

  4. Ask about the problem you're trying to solve. Don't focus too much on debugging your exact solution, as you may be going down the wrong path. Include as much information as you can about what you ultimately are trying to achieve. See more on this here: https://xyproblem.info/

Icon base by Delapouite under CC BY 3.0 with modifications to add a gradient

go to feed...