|
|
Log in / Subscribe / Register

Rust in the 6.2 kernel

Rust in the 6.2 kernel

Posted Dec 13, 2022 11:14 UTC (Tue) by farnz (subscriber, #17727)
In reply to: Rust in the 6.2 kernel by oconnor663
Parent article: Rust in the 6.2 kernel

Yes - apologies for being unclear. I think of reallocations as an optimized form of allocate, copy and deallocate, so it's implicit to me that reallocation can invalidate the original string.

At heart, this is the same problem as iterator invalidation. You have a reference to some underlying data, and changes to that underlying data can result in your reference no longer being valid. C++ has no compiler checks for reference validity, and relies on the programmer not getting it wrong; this makes some sense, since any check for reference validity is going to be conservative and thus will need overriding from time to time, but the history of "rely on the programmer not getting it wrong" suggests it's not a great decision.


to post comments


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds