authorgravatar for aleksey.kladov@gmail.comAlex Kladov <aleksey.kladov@gmail.com> 2025-06-07 18:07:53+01:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2025-06-07 10:07:53-07:00
log173bc4274446a14aca2eea128b70b35b0ba18ebe
treedd8012e109095c457d045e533d16532ac80fbd95
parentaa65fd5d7ca2dda5da8454e863d196745b5a50d3
signaturebadge-check Signed by PGP key B5690EEEBB952194

langref: undefined _is_ materialized in all safe modes (#24107)

* trailing whitespace * langref: undefined _is_ materialized in all safe modes I am also not super happy about the clause that immediately follows. I _believe_ what we want to say here is that, simultaneously: * undefined is guaranteed to be matrerialized in in all safe modes. A Zig implementation that elides `ptr.* = undefined` in ReleaseSafe mode would be a non-conforming implementation. * A Zig program that relies on undefined being materialized is buggy. But I don't think it's the time to engage this level of language-lawering!

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

doc/langref.html.in+2-2
...@@ -777,7 +777,7 @@...@@ -777,7 +777,7 @@
777 value. Using this value would be a bug. The value will be unused, or overwritten before being used."777 value. Using this value would be a bug. The value will be unused, or overwritten before being used."
778 </p>778 </p>
779 <p>779 <p>
780 In {#link|Debug#} mode, Zig writes {#syntax#}0xaa{#endsyntax#} bytes to undefined memory. This is to catch780 In {#link|Debug#} and {#link|ReleaseSafe#} mode, Zig writes {#syntax#}0xaa{#endsyntax#} bytes to undefined memory. This is to catch
781 bugs early, and to help detect use of undefined memory in a debugger. However, this behavior is only an781 bugs early, and to help detect use of undefined memory in a debugger. However, this behavior is only an
782 implementation feature, not a language semantic, so it is not guaranteed to be observable to code.782 implementation feature, not a language semantic, so it is not guaranteed to be observable to code.
783 </p>783 </p>
...@@ -2295,7 +2295,7 @@ or...@@ -2295,7 +2295,7 @@ or
2295 {#code|test_aligned_struct_fields.zig#}2295 {#code|test_aligned_struct_fields.zig#}
22962296
2297 <p>2297 <p>
2298 Equating packed structs results in a comparison of the backing integer, 2298 Equating packed structs results in a comparison of the backing integer,
2299 and only works for the {#syntax#}=={#endsyntax#} and {#syntax#}!={#endsyntax#} {#link|Operators#}.2299 and only works for the {#syntax#}=={#endsyntax#} and {#syntax#}!={#endsyntax#} {#link|Operators#}.
2300 </p>2300 </p>
2301 {#code|test_packed_struct_equality.zig#}2301 {#code|test_packed_struct_equality.zig#}