From f389e5e61fcbc92423c16ccd2d0c79878d1589e4 Mon Sep 17 00:00:00 2001 From: Nathan Michaels Date: Mon, 16 Dec 2019 23:55:35 -0500 Subject: [PATCH] Clarify allowzero's interaction with optional pointers. --- doc/langref.html.in | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/langref.html.in b/doc/langref.html.in index 795bf016e5..5894810555 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -2133,8 +2133,10 @@ fn foo(bytes: []u8) u32 {

This pointer attribute allows a pointer to have address zero. This is only ever needed on the freestanding OS target, where the address zero is mappable. If you want to represent null pointers, use - {#link|Optional Pointers#} instead. In this code example, if the pointer did not have the - {#syntax#}allowzero{#endsyntax#} attribute, this would be a {#link|Pointer Cast Invalid Null#} panic: + {#link|Optional Pointers#} instead. {#link|Optional Pointers#} with {#syntax#}allowzero{#endsyntax#} + are not the same size as pointers. In this code example, if the pointer + did not have the {#syntax#}allowzero{#endsyntax#} attribute, this would be a + {#link|Pointer Cast Invalid Null#} panic:

{#code_begin|test|allowzero#} const std = @import("std");