diff --git a/doc/langref.html.in b/doc/langref.html.in index 37a7ac4c3b875a641699b17437ce88f5d8a0f625..5392522d60b1adfaf94113e07f572b7465add0d5 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -798,7 +798,7 @@ value. Using this value would be a bug. The value will be unused, or overwritten before being used."
- In {#link|Debug#} and {#link|ReleaseSafe#} mode, Zig writes {#syntax#}0xaa{#endsyntax#} bytes to undefined memory. This is to catch + In {#link|debug#} and {#link|safe#} mode, Zig writes {#syntax#}0xaa{#endsyntax#} bytes to undefined memory. This is to catch bugs early, and to help detect use of undefined memory in a debugger. However, this behavior is only an implementation feature, not a language semantic, so it is not guaranteed to be observable to code.
@@ -2854,11 +2854,11 @@ or {#header_close#} {#header_open|unreachable#}
- In {#link|Debug#} and {#link|ReleaseSafe#} mode
+ In {#link|debug#} and {#link|safe#} mode
{#syntax#}unreachable{#endsyntax#} emits a call to {#syntax#}panic{#endsyntax#} with the message reached unreachable code.
- In {#link|ReleaseFast#} and {#link|ReleaseSmall#} mode, the optimizer uses the assumption that {#syntax#}unreachable{#endsyntax#} code + In {#link|fast#} and {#link|small#} mode, the optimizer uses the assumption that {#syntax#}unreachable{#endsyntax#} code will never be hit to perform optimizations.
{#header_open|Basics#} @@ -2871,7 +2871,7 @@ or {#header_open|At Compile-Time#} {#code|test_comptime_unreachable.zig#} - {#see_also|Zig Test|Build Mode|comptime#} + {#see_also|Zig Test|Optimization Mode|comptime#} {#header_close#} {#header_close#} {#header_open|noreturn#} @@ -3094,7 +3094,7 @@ or Here we know for sure that "1234" will parse successfully. So we put the {#syntax#}unreachable{#endsyntax#} value on the right hand side. {#syntax#}unreachable{#endsyntax#} invokes safety-checked {#link|Illegal Behavior#}, so - in {#link|Debug#} and {#link|ReleaseSafe#}, triggers a safety panic by default. So, while + in {#link|debug#} and {#link|safe#}, triggers a safety panic by default. So, while we're debugging the application, if there was a surprise error here, the application would crash appropriately. @@ -3187,7 +3187,7 @@ fn createFoo(param: i32) !Foo {- Error Return Traces are enabled by default in {#link|Debug#} builds and disabled by default in {#link|ReleaseFast#}, {#link|ReleaseSafe#} and {#link|ReleaseSmall#} builds. + Error Return Traces are enabled by default in {#link|debug#} builds and disabled by default in {#link|fast#}, {#link|safe#} and {#link|small#} builds.
There are a few ways to activate this error return tracing feature: @@ -3657,7 +3657,7 @@ void do_a_thing(struct Foo *foo) { {#code|zero_bit_types.zig#}
When this turns into machine code, there is no code generated in the - body of {#syntax#}entry{#endsyntax#}, even in {#link|Debug#} mode. For example, on x86_64:
+ body of {#syntax#}entry{#endsyntax#}, even in {#link|debug#} mode. For example, on x86_64:0000000000000010 <entry>:
10: 55 push %rbp
11: 48 89 e5 mov %rsp,%rbp
@@ -6022,15 +6022,15 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
{#header_close#}
- {#header_open|Build Mode#}
+ {#header_open|Optimization Mode#}
- Zig has four build modes:
+ Zig has four optimization modes:
- - {#link|Debug#} (default)
- - {#link|ReleaseFast#}
- - {#link|ReleaseSafe#}
- - {#link|ReleaseSmall#}
+ - {#link|debug#} (default)
+ - {#link|fast#}
+ - {#link|safe#}
+ - {#link|small#}
To add standard build options to a build.zig file:
@@ -6041,12 +6041,12 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
This causes these options to be available:
- - -Doptimize=Debug
- Optimizations off and safety on (default)
- - -Doptimize=ReleaseSafe
- Optimizations on and safety on
- - -Doptimize=ReleaseFast
- Optimizations on and safety off
- - -Doptimize=ReleaseSmall
- Size optimizations on and safety off
+ - -Doptimize=debug
- Optimizations off and safety on (default)
+ - -Doptimize=safe
- Optimizations on and safety on
+ - -Doptimize=fast
- Optimizations on and safety off
+ - -Doptimize=small
- Size optimizations on and safety off
- {#header_open|Debug#}
+ {#header_open|debug#}
{#shell_samp#}$ zig build-exe example.zig{#end_shell_samp#}
- Fast compilation speed
@@ -6056,8 +6056,8 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
- No reproducible build requirement
{#header_close#}
- {#header_open|ReleaseFast#}
- {#shell_samp#}$ zig build-exe example.zig -O ReleaseFast{#end_shell_samp#}
+ {#header_open|fast#}
+ {#shell_samp#}$ zig build-exe example.zig -Ofast{#end_shell_samp#}
- Fast runtime performance
- Safety checks disabled
@@ -6066,8 +6066,8 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
- Reproducible build
{#header_close#}
- {#header_open|ReleaseSafe#}
- {#shell_samp#}$ zig build-exe example.zig -O ReleaseSafe{#end_shell_samp#}
+ {#header_open|safe#}
+ {#shell_samp#}$ zig build-exe example.zig -Osafe{#end_shell_samp#}
- Medium runtime performance
- Safety checks enabled
@@ -6076,8 +6076,8 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
- Reproducible build
{#header_close#}
- {#header_open|ReleaseSmall#}
- {#shell_samp#}$ zig build-exe example.zig -O ReleaseSmall{#end_shell_samp#}
+ {#header_open|small#}
+ {#shell_samp#}$ zig build-exe example.zig -Osmall{#end_shell_samp#}
- Medium runtime performance
- Safety checks disabled
@@ -6122,7 +6122,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
Most Illegal Behavior is safety-checked. However, to facilitate optimizations, safety checks are disabled by default
- in the {#link|ReleaseFast#} and {#link|ReleaseSmall#} optimization modes. Safety checks can also be enabled or disabled
+ in the {#link|fast#} and {#link|small#} optimization modes. Safety checks can also be enabled or disabled
on a per-block basis, overriding the default for the current optimization mode, using {#link|@setRuntimeSafety#}. When
safety checks are disabled, Safety-Checked Illegal Behavior behaves like Unchecked Illegal Behavior; that is, any behavior
may result from invoking it.
@@ -6464,14 +6464,14 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
@@ -7803,8 +7803,8 @@ fn readU32Be() u32 {} {#syntax#}unreachable{#endsyntax#} can be used to assert that control flow will never happen upon a particular location. Depending on the build mode, {#syntax#}unreachable{#endsyntax#} may emit a panic.