this post was submitted on 12 Feb 2026
59 points (100.0% liked)

Learn Programming

2087 readers
50 users here now

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

founded 2 years ago
MODERATORS
 

I don't need something practical. I just need something fun to keep me motivated.

you are viewing a single comment's thread
view the rest of the comments
[–] ageedizzle@piefed.ca 4 points 2 days ago (4 children)

How does C compare to Rust? I've heard you can learn the syntax in a weekend, but you spend years trying to master it because of all the memory leaks and such that it leads to. Would you say that's accurate?

[–] CameronDev@programming.dev 7 points 2 days ago (1 children)

Rust is close to C++, in that you get a lot of high level constructs to help you. C is very low level, and you can learn the syntax in a weekend, but you'll also have to learn memory management and implement advanced structures (linked lists, etc) yourself.

Memory management isn't too hard, it's mostly remembering who created what, who reads and writes to it, and who is responsible for cleaning up. With some additional comments as you go it's not too hard. Also, depending on what your doing, leaks may be acceptable. A short lived program can leak all it likes, and the OS will clean up for you ibthe end :D

[–] ageedizzle@piefed.ca 2 points 2 days ago

Good to know, thank you for your input

[–] otacon239@lemmy.world 7 points 2 days ago (1 children)

Python is like your automatic transmission. It handles a lot of work on the backend to make life easier, but the trade off is performance and control.

In C/C++, you’re reaching into the gearbox and moving it by hand. It doesn’t clean up anything for you and doesn’t prevent you from making dumb mistakes. In exchange, it can be wildly faster than Python.

In Assembly/Binary, you’re crafting the gears before you can even start the car.

[–] ageedizzle@piefed.ca 2 points 2 days ago (1 children)

Man people actually code in binary? That's hardcore

[–] beveradb@sh.itjust.works 3 points 2 days ago (1 children)

My favourite childhood game RCT2 was a masterpiece of assembly: https://youtu.be/ESGHKtrlMzs

[–] ageedizzle@piefed.ca 2 points 2 days ago

It’s crazy to me that someone actually took the time to write a whole game in assembly. The skill required to do that is remarkable

[–] orclev@lemmy.world 5 points 2 days ago (1 children)

So C is basically assembly with a bunch of syntactic sugar on top. It manages a lot of the book keeping and boilerplate, but at the end of the day there's not a ton of difference between them in terms of the abstractions it provides. If you know assembly learning C is a piece of cake. If you don't you're probably going to take a while to really wrap your head around pointers and the myriad ways C can use them for great and terrible things. Beyond pointers (and race conditions if you're crazy enough to do multithreading in C) the rest of C is super easy because there really isn't much else there.

Rust on the other hand is a much higher level language more comparable to something like Java, C++, or Python. It gives you a lot of tools to solve complicated problems but unlike Java and Python and like C++ it still gives you the option of working at a low level when you need to. The big advantage it has over C++ is that it learned from the many mistakes C++ made over the years, and the borrow checker really is a unique and powerful solution to both memory management but also crucially concurrency problems.

[–] ageedizzle@piefed.ca 4 points 2 days ago (1 children)

Interesting. I always assumed that Rust would be more similar to C since they are now using Rust in the linux kernel

[–] orclev@lemmy.world 6 points 2 days ago (1 children)

No, for a good modern C alternative I'd look at Zig. The main reason C is used for the Linux kernel is because Linus hates C++ for a variety of reasons. For what it's worth I agree with him. Most other OS kernels are written in C++. Linus allowed Rust in because it demonstrated that it could provide the same power as C++ without all of C++'s problems (mostly that over the years it became a kitchen sink language, anything that anyone ever thought might be a good idea got rolled in even when it was incompatible with some other feature already in the language).

[–] ageedizzle@piefed.ca 1 points 2 days ago (1 children)

Thanks for the suggestion. How does Zig compare to C safety wise? One of my main reasons for going for Rust was because I was looking for something like C but safer

[–] orclev@lemmy.world 1 points 1 day ago (1 children)

It's a bit safer and a lot more convenient to use, but still lets you do dangerous things with pointers. At its core it's still fundamentally the same as C just with a bunch of helpful tools and features to make doing all the stuff you do in C easier and more convenient.

Really the biggest thing it does significantly better than C is its macro system. C macros are "dumb" in that the C pre-processor does a simple find and replace on the source files without doing any kind of processing on the underlying C code so you can E.G. write C macros that spit out mangled illegal C code when you run them. Likewise a C #include is literally the same thing as copy and pasting the contents of the included file before it gets fed into the compiler.

Zig on the other hand has a smart macro system that's actually aware of the zig code and works in concert with it at compile time.

[–] ageedizzle@piefed.ca 1 points 1 day ago

Okay that makes sense. Thanks for the comparisons here

[–] ImgurRefugee114@reddthat.com 3 points 2 days ago* (last edited 2 days ago) (1 children)

Somewhat. The issue isn't memory leaks themselves so much as learning project architecture, patterns, and generally how to do things without shooting yourself in the foot.

Rust has plenty of gotchas and unintuitive elements, so they're not too different in that sense. Though Rust is more likely to point out when you've done something wrong, where as C will exercise your debugging skills.

Modern C++ is also an option, and surprisingly easy to use. The only catch is that the errors can be very difficult to parse and it's hard to find modern best-practice materials to learn from since most of industry is quite far behind compared to where the language is.

One benefit Rust has is that it's quite new and niche, so the materials tend to be of fresh, without much legacy mindset, and of a relatively high quality. Tbh I'm not sure how Rust is for newbies, but it may be worth a shot. At the very least, the community is passionate and the errors will be readable...

[–] ageedizzle@piefed.ca 2 points 2 days ago

generally how to do things without shooting yourself in the foot

In programming, as in life, this is key.

To your point, I have found the error messages and the documentation for Rust to be super helpful and easy to read. As a newbie it is straightforward enough, but it's really an endurance game, because I think unlike other languages you need to cross a critical threshold before you can really understand the language well enough to use it even for simple tasks