Skip to content

Commit b144532

Browse files
author
Benjamin Herr
committed
Pointer<->address cast: stylistic changes.
1 parent ec33e2b commit b144532

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/expressions/operator-expr.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -361,11 +361,17 @@ Here `*T` means either `*const T` or `*mut T`.
361361
* `u8` to `char` cast
362362
* Casts to the `char` with the corresponding code point.
363363
* Pointer to address cast
364-
* Casting from a valid raw pointer to `usize` will produce the address that is pointed to. Note that the pointer's provenance is lost in this conversion.
364+
* Casting from a valid raw pointer to `usize` will produce the address that is pointed to.
365+
366+
The pointer's provenance is lost in this conversion.
365367
* Address to pointer cast
366368
* Casting from `usize` to a raw pointer will produce a raw pointer to the same location as the original pointer, if the `usize` was obtained through a pointer to address cast of a valid pointer.
367369

368-
Note that the two pointers are not equivalent. Dereferencing the pointer obtained from the address to pointer cast may be [undefined behavior] if aliasing rules are not followed.
370+
<div class="warning">
371+
Warning:
372+
The two pointers are not equivalent.
373+
Dereferencing the pointer obtained from the address to pointer cast may be <a href="../behavior-considered-undefined.md">undefined behavior</a> if aliasing rules are not followed.
374+
</div>
369375

370376
\* if integer-to-float casts with this rounding mode and overflow behavior are
371377
not supported natively by the hardware, these casts will likely be slower than
@@ -379,8 +385,6 @@ expected.
379385
number, preferring the one with an even least significant digit if exactly
380386
halfway between two floating point numbers.
381387

382-
[undefined behavior]: ../behavior-considered-undefined.md
383-
384388
## Assignment expressions
385389

386390
> **<sup>Syntax</sup>**\

0 commit comments

Comments
 (0)