| ... | @@ -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 unsafe | 2791 | {#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 other | 2792 | 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#} |
| 2796 | const std = @import("std"); | 2798 | const 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#} |
| 8598 | | 8601 | |