Ask HN: Rust or C or C++ in 2023?
11–20 of 56 posts
Re: Ask HN: Rust or C or C++ in 2023?
#12Re: Ask HN: Rust or C or C++ in 2023?
#13Then 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 Microsoft where C++ fills that role.
Re: Ask HN: Rust or C or C++ in 2023?
#14C++ is not a bad place to start, as any decent course in it will, after the basic concepts of variables, loops, arrays, functions, pointers and memory, algorithms & data structures, introduce you to both classes and inheritance and encapsulation (the typical object-oriented paradigm) as well as how to write functions with nested lambdas (the basic functional paradigm). From there you can pick up almost any 'higher-level' language like Java, Python, etc. that utilizes some kind of virtual machine/interpreter to run the code, the various pure functional languages and so on.
Learning C and/or Rust is then a lot more accessible I think. You'll have some grasp of why 'memory-safe' Rust became fairly popular, and of why C's more low-level and simpler approach (no classes, inheritance, etc.) relying on structs, function pointers, etc. instead is still attractive, flaws and all.
The underlying theme though is that these languages all compile directly without any Python-like 'bytecode' intermediate, so probably at some point diving into the assembly output for specific platforms (x86-64, ARM, RISC-V) will be worthwhile, for which godbolt.org is the place to go.
Re: Ask HN: Rust or C or C++ in 2023?
#15So while Rust and C++ are higher-level languages with all kinds of nice features to be safer, concise, structured, etc. they are not good at all for learning how to work at this low-level. Wielding either of them well for systems code is quite advanced.
C and assembly are where you really need to start.
Re: Ask HN: Rust or C or C++ in 2023?
#16I would choose Rust because it has much better developer ergonomics than C. Even the little things like having a standard linter and package manager (Cargo) go a long way in writing idiomatic code. You can't go wrong with either choice, so choose the one that makes you most productive.
Re: Ask HN: Rust or C or C++ in 2023?
#17Re: Ask HN: Rust or C or C++ in 2023?
#18- The Race to Replace C & C++ (2020) [0]
- The Race to Replace C & C++, Episode 2 (2021) [1]
- Memory Strategies: The Merits of (Un)safe (2022) [2]
They feature prominent guests including the creators of Zig and Odin, as well as people making a living using Rust. Hope this helps!
[0] https://handmade.network/podcast/ep/fe1a2a6a-3ac6-4ce5-b8fb-...
[1] https://handmade.network/podcast/ep/57103cab-ff39-42b4-b59b-...
[2] https://handmade.network/podcast/ep/afc72ed0-f05f-4bee-a658-...
Re: Ask HN: Rust or C or C++ in 2023?
#19Re: Ask HN: Rust or C or C++ in 2023?
#20Learn 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…
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.