authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-01-18 20:58:35-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-01-18 22:01:09-07:00
log8662c0ff43aad7191b063047c71384e868086d6f
treef4003dec357690313fd9e0348de49e4ac9bdb614
parent9e6ff713300295150a02c6ab12852d325d92559a

langref: avoid the ambiguous word "safe"

See #2402

1 files changed, 7 insertions(+), 4 deletions(-)

doc/langref.html.in+7-4
......@@ -2788,9 +2788,11 @@ test "volatile" {
27882788 </p>
27892789 {#header_close#}
27902790 <p>
2791 To convert one pointer type to another, use {#link|@ptrCast#}. This is an unsafe
2792 operation that Zig cannot protect you against. Use {#syntax#}@ptrCast{#endsyntax#} only when other
2793 conversions are not possible.
2791 {#link|@ptrCast#} converts a pointer's element type to another. This
2792 creates a new pointer that can cause undetectable illegal behavior
2793 depending on the loads and stores that pass through it. Generally, other
2794 kinds of type conversions are preferable to
2795 {#syntax#}@ptrCast{#endsyntax#} if possible.
27942796 </p>
27952797 {#code_begin|test|test_pointer_casting#}
27962798const std = @import("std");
......@@ -8592,7 +8594,8 @@ test "decl access by string" {
85928594 <pre>{#syntax#}@floatFromInt(int: anytype) anytype{#endsyntax#}</pre>
85938595 <p>
85948596 Converts an integer to the closest floating point representation. The return type is the inferred result type.
8595 To convert the other way, use {#link|@intFromFloat#}. This cast is always safe.
8597 To convert the other way, use {#link|@intFromFloat#}. This operation is legal
8598 for all values of all integer types.
85968599 </p>
85978600 {#header_close#}
85988601