Skip to content

Commit d65e590

Browse files
author
Benjamin Herr
committed
Document raw pointer <-> usize casts.
1 parent 3b6fe80 commit d65e590

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/expressions/operator-expr.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,10 @@ Here `*T` means either `*const T` or `*mut T`.
360360
* `char` casts to the value of the code point, then uses a numeric cast if needed.
361361
* `u8` to `char` cast
362362
* Casts to the `char` with the corresponding code point.
363+
* Pointer to address cast
364+
* Casting from a valid raw pointer to `usize` will produce a numeric address representing the pointer.
365+
* Address to pointer cast
366+
* Casting from `usize` to a raw pointer will produce a pointer with the same value as the original pointer if the `usize` was obtained through a pointer to address cast of a valid pointer of the same type.
363367

364368
\* if integer-to-float casts with this rounding mode and overflow behavior are
365369
not supported natively by the hardware, these casts will likely be slower than

0 commit comments

Comments
 (0)