3 ms·
In languages like C, C++, Rust, Swift, and C#, either not all types have to be heap-allocated reference types, or the runtime will handle copy-on-write for you,
by TazeTSchnitzel 4y ago
In languages like C, C++, Rust, Swift, and C#, either not all types have to be heap-allocated reference types, or the runtime will handle copy-on-write for you, so it's convenient to create and work with small value types. It's unfortunate that so many popular languages don't do this. Having everything on the heap is not good for performance and creates an unnecessary choice between mutability and aliasing.
- cbrogrammer 4y agothere is no copy-on-write in the C language
- skitter 4y agoBut in C, the first half of the 'or'-dtatement applies.