2 ms·
Sure, it's the default, but C and C++ encourage have patterns where calls to `malloc` and `new` much more common than in Rust. Especially since strings are almo
by falcolas 10y ago
Sure, it's the default, but C and C++ encourage have patterns where calls to `malloc` and `new` much more common than in Rust. Especially since strings are almost always handled as malloc'ed buffers.
I'm just wondering if the extra emphasis on stack allocation has created issues; this article doesn't cover the allocation of Strings or Vecs (wrapping them in RC and ARC boxes), and most other references on the net are a few years old now.
- deleted 10y ago[deleted]
- masklinn 10y ago> I'm just wondering if the extra emphasis on stack allocation has created issues; this article doesn't cover the allocation of Strings or Vecs As in C++, these are small stack structures (a few words, IIRC it's 3 for Vec, and String is backed by a Vec) pointing to a heap-allocated buffer.
- steveklabnik 10y agoThe second edition of the book goes into it in great detail https://doc.rust-lang.org/nightly/book/second-edition/ch04-01-what-is-ownership.html https://doc.rust-lang.org/nightly/book/second-edition/ch04-0...