[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip / qa] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: Rust_vs_C_800x533.jpg (67 KB, 800x533)
67 KB
67 KB JPG
What are the main differences between Rust and C++? What are these languages used for in the real world?
>>
Why you make the same thread again?
>>
rust - rewriting things written in c++
c++ - writing things to be rewritten in rust
>>
>>102448132
vercel rewrote their go stuff to rust though
>>
>>102448109
Rust has a standardized packaging and build system while C++ has multiple of both.
C++ is object-oriented, to share behaviour in non-generic code you inherit from some base type, specified at type definition. Rust isn't, to share behaviour you define a trait that you implement on types you want.
Rust is more explicit, you need to create a reference to a local value yourself in the caller, while C++ will just auto convert it. In generic rust code to use anything from a generic type you need to bound it at the front to make sure it has that. In generic C++ code the compiler will try to instantiate/guess generic code until it completely runs out of options. This created SFINAE, which basically makes the type system itself turing complete and is a logic/functional programming language in itself, but instead of folding on values you're folding on types.
Rust's type system includes lifetimes which allow you to include existence relationships, ie. while this exists that has to exist
Rust has a borrow checker which ensures references are always valid without a GC and all the lifetime rules are followed, C++ has no such mechanism
Rust doesn't allow a few potentially-unsafe operations unless you explicitly opt in by using an unsafe block. The goal is to separate the code compiler cannot check, create an interface with the conditions it requires, then have them enforced by the compiler
>>
rust: how much do we need to pessimize C compiler (e.g. make large subset of valid syntax illegal to write, because... reasons) to remove memory bugs.

rust is a penis cage of programming language that prevents fucking around with memory.
>>
>>102448109
C++ is tolerable, programming Rust is like cutting grass around a forest of trees using an electric mower and you can never run over the power cord..
Well, that's what my friend told me.
>>
>>102448119
I didnt? i think ur going about another dude. I made a thread a few weeks back asking why is rust bad.
>>
>>102449876
/thread
>>
>>102450100
Can you please elaborate



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.