(un)aligned
This commit is contained in:
parent
dc2237c49f
commit
b463871df5
1 changed files with 2 additions and 2 deletions
|
@ -748,8 +748,8 @@ pub unsafe fn write<T>(dst: *mut T, src: T) {
|
|||
/// // Take a reference to a 32-bit integer which is not aligned.
|
||||
/// let unaligned = &mut x.unaligned as *mut u32;
|
||||
///
|
||||
/// // Dereferencing normally will emit an unaligned store instruction,
|
||||
/// // causing undefined behavior.
|
||||
/// // Dereferencing normally will emit an aligned store instruction,
|
||||
/// // causing undefined behavior because the pointer is not aligned.
|
||||
/// // *unaligned = v; // ERROR
|
||||
///
|
||||
/// // Instead, use `write_unaligned` to write improperly aligned values.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue