Which language gives users more control, C++ or Rust

What can C++ do more conveniently compared to Rust?

1 Like

Honest question: are you looking for a piece of information that wasn't already covered in your previous thread?

It seems like you are looking for a simple answer that doesn't exist.

2 Likes

I just can't seem to find a good tutorial for Rust, with C++ tutorials I have found they are much better at teaching compared to Rust tutorials, so I want to know what is different about it.

That seems like a very different question.

Why is "more control" the criterion you are most interested in?

Cause a freind of mine uses C++ a lot and when he tried out Rust he said that he found it more restrictive.

It is more restrictive, indeed. But only in the sense that a car with seatbelts is more restrictive than one without: both reach the same top speed, but only one of them will save you in a bad day :blush:

27 Likes

Oh lol thanks bro, are there any good tutorials out there for Rust?

New Rustacean is a good way to get started, along with reading the book :+1:t2:

1 Like

Rust by example has good explanations, with code that executes straight from your browser (it gets compiled somewhere else).

1 Like

And to extend the analogy, you're not going to try flying upside-down without a harness :rocket:

2 Likes

It is because of age. C++ is around long enough for people to write good tutorials. The rust documentation and other tutorials in the ecosystem are good enough for a language that is stable for 3 years.

8 Likes

https://doc.rust-lang.org/book/second-edition/index.html

2 Likes

@Joe232 Why don't you tell us more about what you personally what to achieve with systems programming languages like C++ and Rust as well as expanding on why the question of control would be important to the work you want to do with these languages?

4 Likes

I do want to get into robotics, as well as game development for Godot.

I have seen some C++ used in Godot (in an example) and it is not really hard to use at all when you are making a game as you are just using Godot's libraries so I wanted to use it over C# as you can get better performance, yes I am well aware that system's programming language != speed but in Godot's benchmark test with all the languages used, C++ was the winner over the rest of the languages.

I do want to learn more about computers and doing low level programming will give me extensive knowledge about how things just work.

Honestly I have been trying to find good video tutorails for Rust but nothign really seems to exist. Yes sure there is Rust docs but I find the video tutorials more helpful (its just me personally) and so far there are much better tutorials for C++ than Rust and I am even finding C++ easier to learn compared to Rust (as the Rust tutorials sucks).

If you are looking specifically for video tutorials, I think you're going to have a hard time finding something that really fits your needs. And this goes back to what @dylan.dpc said about the age of the language.

On the other hand there are a few streamers out there that use Rust in their live coding. So you might be able to find something that almost-kind-of-sort-of matches your expectations with what you've seen for C++. You just have to know what to look for... Searching Youtube for "rust-lang tutorial" brought up hundreds of results, and the first two I clicked on were basic hello-world tutorials with good clear video and audio. (I can't comment on the quality of the tutorial content, though.)

To give you at least something to start with, it just so happens that I met a guy at a demoscene meetup a few years ago after GDC. He started writing emulators (and other tools) in Rust as part of his live coding Twitch channel. You can find all of those videos now on his Youtube channel.

The Nintendo 64 emulator playlist is probably a good one to start with, since the first episode actually walks you through creating a crate, and discusses how to find and navigate the Rust documentation. I haven't actually watched the whole series (it's a LOT of content) but it seems like it might be similar to what you're looking for, in terms of ultra-beginner-friendly instructive videos. He has some other relevant playlists as well.

3 Likes

Yes correct, however I have already in the past started with thenewboston and he is quite good (the best in my opinion). Yes I know nobody can get me where I want to but at least he can start me off before I do my own stuff.

Now I have tried using Rust tutorials and one quy was pretty good at teaching, but he for no reason stopped making tutorials (I hope the dude is ok), and the other tutorials aren't that great, they tell you this and that but sometimes fail to explain certain things, and some just rush :confused:

Some people tell me that Rust is not even fully ready yet and there are still stuff that needs working, am I correct with this?

That is not to say that I will not learn Rust. Off course I will learn Rust, as well as C++ as there are more job opportunities for C++ and better support for Godot as well while learning C++ helps me learn Rust as well.

1 Like

I wonder what a video tutorial can give you, what a text tutorial won't. IMHO a video is not as good as a text, because it dictates the speed of learning. If you haven't understood a part, you have to rewind to the exact time and hear it again and again. In a text you just go up a few lines and you can read as slow and fast as you please. You can read every sentece twice, as it makes sense to you. (But maybe I'm just too old for this youtube tutorial bs :smiley: (no offense :wink: )).
For general tutorials in rust I can tell you: "Just do it!". You learn it, as you program. Go and make a simple application (here a few suggestions)

  • read a number from stdin and print it
  • generate a random number and make a guessing game
  • read a file and try to copy it to a different location
  • list the content of a directory
  • copy all files from one directory to another

... The possibilities are endless, but you learn it by simply doing it (just like any other regular (human) language. So go and install the toolchain and happy rusting :wink:

3 Likes

For some value of "fully ready", sure. In the same sense that C++ isn't fully ready either, as evidenced by the current C++ specification. Any language that isn't completely at its end-of-life is in some form a work in progress.

That doesn't mean that Rust and C++ are not useful. Or to remove the double-negative; "that means that Rust and C++ are still useful." I hope you understand that practically every concern you've had isn't quite so black-and-white as you seem to believe.

3 Likes

Just to show how both C++ and Rust are evolving, there are different things that you can find in one language and missing in the other.

Rust is gradually implementing constant time function evaluation, and the road for variadic generics seems to be still long. Instead, in C++17 we gained if constexpr to help with constant time metaprogramming, and the fold expressions now allow to complex things without compile time recursion.

On the other hand, it is impossible, at to date, to perform a destructive move in C++, which is a regular and simple move in Rust. Experienced C++ programmers also know that in the Standard template library, an iterator when deferenced must return a reference, disallowing any form of adaptor or smart accessor. This last thing will change with the introduction of a very basic form of the so-called ranges. Rust does not have all these issues, because iterators work in a totally different way... and if you ever implemented an iterator in C++, you already know that the Rust way is much easier.

IMHO, it is always good to have evolving languages like C++ and Rust which have the same aim (full control, zero overhead abstraction and so on) but different ideas about the goals have to be reached. Take a simple example: coroutines! Both languages are trying to stabilize this (old) concept, and they will probably find different approaches.

Final note: we are not considering other languages like Haskell, which is very powerful. I cannot say anything because of my ignorance, but surely other people like @Centril could probably assert that there are things in which Haskell wins over Rust and C++

Saying that a language is better/more powerful than another in absolute is probably limiting and conceptually erroneous.

3 Likes

My suggestion is to learn PIC assembly programming An Introduction to PIC Assembly Language Programming | Microcontroller Tutorials

Software people don't go to that level (or very rarely do), it's more for computer and electronic engineering peeps. That's also the lowest level you can possibly go before actually buying logic gates and sticking them in a protoboard, wiring them up to do the base level logic gate programming.

Another low-level thing to do is to learn to program FPGAs Cost-Optimized Portfolio

Both for PICs and FPGAs use the Development boards you can find at your nearest electronic hobby shops.

After learning PIC programming, you can conceivably learn Rust as a way to increase your PIC programming productivity - this is where you will understand "zero cost abstraction". FPGAs can't be programmed in Rust because you need a hardware-descriptive language for that, although there could possibly be a way to convert Rust to VHDL.

VHDL will be much different from 'normal' computer programming. The hardware inherently generates parallel processing and the bottom part of your code will compute at the same time as the top part of your code. Then there are various timing issues you will need to address in the asynchronous parts of the program. There's a reason why FPGA programming is much less widespread, to say the least. But, you can plug in libraries that simulate CPU cores with FPGAs - allowing you fine-grained control over a CPU implementation in the debug stage of the hardware-software interface.

3 Likes