authorgravatar for shritesh@shritesh.comShritesh Bhattarai <shritesh@shritesh.com> 2019-05-30 19:38:26-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-05-31 02:26:19-04:00
log6d73e5de058ea421a98a53ae6c0844860715cc01
tree10ccbcef5cc788d53e6fa7031405e2693deaa164
parent0ccd91faea5ec27a1dce9d3bae84e1feca7fc0ea

doc: recommend optional pointers for nullptrs instead of allowzero


1 files changed, 3 insertions(+), 3 deletions(-)

doc/langref.html.in+3-3
......@@ -2026,9 +2026,9 @@ fn foo(bytes: []u8) u32 {
20262026 {#header_open|allowzero#}
20272027 <p>
20282028 This pointer attribute allows a pointer to have address zero. This is only ever needed on the
2029 freestanding OS target, where the address zero is mappable. In this code example, if the pointer
2030 did not have the {#syntax#}allowzero{#endsyntax#} attribute, this would be a
2031 {#link|Pointer Cast Invalid Null#} panic:
2029 freestanding OS target, where the address zero is mappable. If you want to represent null pointers, use
2030 {#link|Optional Pointers#} instead. In this code example, if the pointer did not have the
2031 {#syntax#}allowzero{#endsyntax#} attribute, this would be a {#link|Pointer Cast Invalid Null#} panic:
20322032 </p>
20332033 {#code_begin|test|allowzero#}
20342034const std = @import("std");