Warning
This post was published 55 days ago. The information described in this article may have changed.
Behavior considered undefined - The Rust Reference says:
Whether a value is valid depends on the type:
- [...]
- An integer (
i*
/u*
), floating point value (f*
), or raw pointer must be initialized, i.e., must not be obtained from uninitialized memory.
What if we implement a user-defined memcpy
? The preliminary thought is to use * const u8
to point to every byte and read them to copy every byte to another space. However, what if reading padding bytes? Which is considered uninitialized memory. Does it mean we cannot correctly implement our memcpy
in Rust?
6 posts - 3 participants
🏷️ rust_feed