Hello Rustians ! I am just new to rust . Why rust use C++

Hello Rustians !! I am just new to rust . Why rust use C++ when it has its own compiler ?? Why its says you need C++ Build Tools ?
I am game developer and was using Unity as game engine. Now switching to rust. May be its good for game development as I have gone through many forums. So, is rust is fast as C++. And Does it truly a OOP language ?

Despite its name, it's not a tool just for C++ development. It's a tool for developing native windows binary.

3 Likes

OK. Thanks

Currently the Rust compiler uses LLVM as it back end for code optimisation and generation. As do many languages. LLVM is written in C++. Rust also needs a linker, again written in C or C++.

This is al a shame and I wish there was a Rust only Rust compiler.

I know nothing about Unity but I would imagine using it from Rust is somewhat harder than its natural C/C++ APIs.

Rust can certainly be as fast as C++. See Rust vs C clang - Which programs are fastest?. But given that the bulk of processing in anything using Unity will be done in Unity(C++) and differences probably would not show much.

Rust is not an OOP langage. OOP is not the be all and end all of programming styles.

3 Likes

I believe that Rust uses the system linker; on Windows, that's provided by a package called "C++ Build Tools."


I can't really speak to that directly, as I've only dabbled in game development a bit as a hobby. Do note, however, that Rust is really just a general-purpose programming language— It won't give you the same kind of unified game editor experience you're used to in Unity. (Though that kind of tool that uses Rust might be available somewhere, idk)


That's a matter for some debate. It certainly lacks some of the features that are common to many modern OOP languages (notably, implementation inheritance); whether or not those are required for a language to be "truly OOP" is a semantic debate that is unlikely to actually help anyone.

2 Likes

No, thankfully. Also, no mainstream language today – including C++ – is truly object-oriented.


By the way, asking "Is X a Y-oriented language" is an entirely useless question. It's mostly debating definitions, and/or it suggests that you are trying to write another language (Java, C++, or anything you may be familiar with) in Rust. That's not going to work.

1 Like

I think you are thinking about MSVC C++ Build Tools? It's needed for linking and OS specific things. Rust does not use C++ the language itself.

I would recommend against using Rust on gamedev if you are seriously trying to build a game and sell it for big profit for varying reasons (library stability, learning materials, communitty resources, etc.) But if you are just doing it for fun, then sure try it out!

Yes, Rust is as fast as C++, the same way C++ is as fast as C.

No, at least not fully. Rust has no inheritance. But OOP is a really broad concept anyway. I won't bother to identity whether a language is an "OOP language".

1 Like

Thanks guys. Your Response was very quick and also helpful. I found Fyrox game engine. Unity engine like editor with Rust programming as scripting.

Mostly due to the need in a linker. You can use a built-in one, but MSVC’s one is preferred for Windows.

No, Rust is not “truly an OOP language”. While it has some things considered OOP’s principles and even objects implemented, “idiomatic” coding in Rust is very different from traditional OO-styled.

Generally, it pretty much is adequate to C++ in terms of performance, sometimes surpassing it or being a bit inferior. That’s mostly the question of just your way of implementing things (and, of course, the compiler and its settings).

1 Like

Indeed - doesn't have to be rust only - but would be good to have a lifeboat if LLVM goes under.

Go has 3, C/C++ in their many versions almost uncountably many.

Are you aware of the in-development Cranelift backend? GitHub - rust-lang/rustc_codegen_cranelift: Cranelift based backend for rustc

4 Likes

In addition the cg_clif mentioned above, there's also GitHub - rust-lang/rustc_codegen_gcc: libgccjit AOT codegen for rustc

(And other, less far along, backends like GitHub - FractalFir/rustc_codegen_clr: This rust compiler backend emmits valid CLR IR, enabling you to use Rust in .NET projects)

2 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.