Live data from Hacker News

Ask HN: Rust or C or C++ in 2023?

news.ycombinator.com

21–30 of 56 posts

Re: Ask HN: Rust or C or C++ in 2023?

#21
C. It's the only language people writing bootloaders, writing kernels, and writing serious userland code kinda sorta agree on.

Maybe someday it'll be rust, but if so that day isn't this year or next. Plenty of time to pick it up for your next job.

Re: Ask HN: Rust or C or C++ in 2023?

#23
post #15

The key to any of embedded, system, or low-level programming is as much about learning how the computer actually works to a reasonable degree. You are not programming to an abstract computation model. You are moving bits and bytes around and generating assembly code and talking to the machine at quite a low-level . So while Rust and C++ are higher-level languages with all kinds of nice features to be safer, concise,…

C is an abstract computer as much as any virtual machine. Now this computer is quite simple compared to the abstract machines of Rust and C++ but is doesn’t have much to do with how a computer actually works.

Re: Ask HN: Rust or C or C++ in 2023?

#25
For low-level programming in 2023 I would honestly start with Zig.

It offers the same system programming capabilities as C but makes it much easier to write correct programs.

(If Rust is the “better C++”, then Zig is the “better C”).

Re: Ask HN: Rust or C or C++ in 2023?

#26
post #15

The key to any of embedded, system, or low-level programming is as much about learning how the computer actually works to a reasonable degree. You are not programming to an abstract computation model. You are moving bits and bytes around and generating assembly code and talking to the machine at quite a low-level . So while Rust and C++ are higher-level languages with all kinds of nice features to be safer, concise,…

c doesn’t have any good game engines or physics libraries. missing other stuff too. otherwise it’s perfect.

passing structs to functions is probably the way, but a struct with functions works too.

Re: Ask HN: Rust or C or C++ in 2023?

#28

Learn enough C to encounter the pain points C++ & Rust are trying to solve. C is simple, but not easy. Then learn enough Rust to be productive. Then learn enough C++ to interact with the enormous amounts of existing C++ code. Once you know a bit of all 3, decide where to focus based on the work you're trying to do. Rust is the easiest, but least widely supported. C is necessary either way, unless you're working for M…

> C is simple, but not easy. I think I know what you're trying to say, but unfortunately C is anything but simple. The semantics are riddled with surprises of all kinds. It's unlikely the average C programmer has never written a program with undefined behavior, for example.

I'd go so far as to say it's unlikely the average C programmer has ever written a program with defined behaviour.

Re: Ask HN: Rust or C or C++ in 2023?

#29

C is the best choice to learn systems programming. C is the simplest of C, C++, or Rust and most other languages have C interop or foreign function interface. First learn C and then you can learn Rust or C++ if needed. The concepts you learn in C programming will help you to better understand the more advanced concepts used in Rust or C++. Recommended first book: https://en.wikipedia.org/wiki/The_C_Programming_Langua…

+1 and I say this as a rust fan.

The rust programmers that learned C first always have very elegant solutions and have the least issues in their unsafe blocks.

C to learn how memory works and how to manage resources, then Rust to understand how to use a higher level systems language for more productivity in places where it helps.

I work as a C++ dev and there are jobs in it, but unless you are trying to work a C++ job, the other two are wayyy better.

Re: Ask HN: Rust or C or C++ in 2023?

#30

Learn enough C to encounter the pain points C++ & Rust are trying to solve. C is simple, but not easy. Then learn enough Rust to be productive. Then learn enough C++ to interact with the enormous amounts of existing C++ code. Once you know a bit of all 3, decide where to focus based on the work you're trying to do. Rust is the easiest, but least widely supported. C is necessary either way, unless you're working for M…

> C is simple, but not easy. I think I know what you're trying to say, but unfortunately C is anything but simple. The semantics are riddled with surprises of all kinds. It's unlikely the average C programmer has never written a program with undefined behavior, for example.

Right. But you can fumble through writing a lot of (maybe subtly wrong) C code. I certainly did for many years. You can't fumble through writing Rust. Its an order of magnitude more difficult to learn because the compiler won't compile "bad" code. Unlike C all the pain happens up front.

Rust hurts when you're learning it. C hurts when you're trying to debug your program.

If you've never written low level code before, I wouldn't start with rust. Zig or C are both much better options when getting started. But learning rust eventually will make you a better programmer.

Post reply on HN