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 {
  • These primitives give enough expressiveness that it's completely practical to have failing to check for an error be a compile error. If you really want to ignore the error, you can add {#syntax#}catch unreachable{#endsyntax#} and - get the added benefit of crashing in Debug and ReleaseSafe modes if your assumption was wrong. + get the added benefit of crashing in {#link|debug#} and {#link|safe#} modes if your assumption was wrong.
  • Since Zig understands error types, it can pre-weight branches in favor of @@ -3269,7 +3269,7 @@ fn createFoo(param: i32) !Foo { to increase their development pace.

    - 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

    • Finally, if none of the above apply, you need a general purpose allocator. - If you are in Debug mode, {#syntax#}std.heap.DebugAllocator{#endsyntax#} is available as a + If you are in {#link|debug#} mode, {#syntax#}std.heap.DebugAllocator{#endsyntax#} is available as a function that takes a {#link|comptime#} {#link|struct#} of configuration options and returns a type. Generally, you will set up exactly one in your main function, and then pass it or sub-allocators around to various parts of your application.
    • - If you are compiling in ReleaseFast mode, {#syntax#}std.heap.smp_allocator{#endsyntax#} is + If you are compiling in {#link|fast#} mode, {#syntax#}std.heap.smp_allocator{#endsyntax#} is a solid choice for a general purpose allocator.
    • @@ -6611,7 +6611,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val Example of what is imported with {#syntax#}@import("builtin"){#endsyntax#}:

      {#builtin#} - {#see_also|Build Mode#} + {#see_also|Optimization Mode#} {#header_close#} {#header_open|Compilation Model#}

      @@ -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.

        -
      • Emits a panic in {#syntax#}Debug{#endsyntax#} and {#syntax#}ReleaseSafe{#endsyntax#} mode, or when using zig test.
      • -
      • Does not emit a panic in {#syntax#}ReleaseFast{#endsyntax#} and {#syntax#}ReleaseSmall{#endsyntax#} mode.
      • +
      • Emits a panic in {#link|debug#} and {#link|safe#} mode, or when using zig test.
      • +
      • Does not emit a panic in {#link|fast#} and {#link|small#} mode.
      • See also {#link|unreachable#}