Rust Interract With C

Posted on  by  admin
Rust Interract With C Rating: 3,8/5 4724 votes
Interract
Posted byemu29 days ago

This question has likely been asked before in some form; but I would like to hear from people who know Rust better than me, what makes programming in Rust better than programming in C and C++? And when I say Rust, I don't mean just the language or the compiler, I mean the entire development 'environment' including Cargo, Clippy, etc. tooling. Even more specifically, what are specific innovations that Rust might present in the following areas compared to C and C++ development.

I have a saying that summarizes my opinion of Rust compared to Go: “Go is the result of C programmers designing a new programming language, and Rust is the result of C programmers designing a new programming language”. This isn’t just a metaphor - Go was designed by plan9 alumni, an operating system written in C and the source of inspiration for many of Go’s features, and Rust was.

  • Macros

  • Errors, error-handling

  • External functions

  • Constants

  • Passing data to a function

Rust Interract With C

I often hear people talk about things that Rust simply encourages, such as zero-cost abstractions and zero-copy operations. There isn't anything about C or C++ that directly prevents zero-cost abstractions - right? I would like to know what are very concrete things that Rust does that C or C++ fundamentally cannot do in relation to the things I listed above.


Edit:

Here are some things that I suspect might be improvements but I might be completely wrong so please let me know

  • Macros are expanded in a different way

  • Errors in macro parsing are handled better

  • Errors in macro after expansion are handled better

  • Errors can be reported to a user of a library better

  • Some errors in calling external functions can be reported at compile time

  • Some kinds of constants are supported in Rust but not in C or C++

  • When data is passed to a function, there are static guarantees provided

Rust interact with cars

Are any of these sort-of true?


Edit:

By the way, I'm not asking this for myself. This is more of a 'survey'.

Rust Can't Interact With Anything

56 comments
Coments are closed
Scroll to top