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" {...@@ -2788,9 +2788,11 @@ test "volatile" {
2788 </p>2788 </p>
2789 {#header_close#}2789 {#header_close#}
2790 <p>2790 <p>
2791 To convert one pointer type to another, use {#link|@ptrCast#}. This is an unsafe2791 {#link|@ptrCast#} converts a pointer's element type to another. This
2792 operation that Zig cannot protect you against. Use {#syntax#}@ptrCast{#endsyntax#} only when other2792 creates a new pointer that can cause undetectable illegal behavior
2793 conversions are not possible.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.
2794 </p>2796 </p>
2795 {#code_begin|test|test_pointer_casting#}2797 {#code_begin|test|test_pointer_casting#}
2796const std = @import("std");2798const std = @import("std");
...@@ -8592,7 +8594,8 @@ test "decl access by string" {...@@ -8592,7 +8594,8 @@ test "decl access by string" {
8592 <pre>{#syntax#}@floatFromInt(int: anytype) anytype{#endsyntax#}</pre>8594 <pre>{#syntax#}@floatFromInt(int: anytype) anytype{#endsyntax#}</pre>
8593 <p>8595 <p>
8594 Converts an integer to the closest floating point representation. The return type is the inferred result type.8596 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.
8596 </p>8599 </p>
8597 {#header_close#}8600 {#header_close#}
85988601