| ... | @@ -1,10 +1,10 @@ | ... | @@ -1,10 +1,10 @@ |
| 1 | <!doctype html> | 1 | <!doctype html> |
| 2 | <html> | 2 | <html lang="en"> |
| 3 | <head> | 3 | <head> |
| 4 | <meta charset="utf-8"> | 4 | <meta charset="utf-8"> |
| 5 | <title>Documentation - The Zig Programming Language</title> | 5 | <title>Documentation - The Zig Programming Language</title> |
| 6 | <link rel="icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAgklEQVR4AWMYWuD7EllJIM4G4g4g5oIJ/odhOJ8wToOxSTXgNxDHoeiBMfA4+wGShjyYOCkG/IGqWQziEzYAoUAeiF9D5U+DxEg14DRU7jWIT5IBIOdCxf+A+CQZAAoopEB7QJwBCBwHiip8UYmRdrAlDpIMgApwQZNnNii5Dq0MBgCxxycBnwEd+wAAAABJRU5ErkJggg=="/> | 6 | <link rel="icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAgklEQVR4AWMYWuD7EllJIM4G4g4g5oIJ/odhOJ8wToOxSTXgNxDHoeiBMfA4+wGShjyYOCkG/IGqWQziEzYAoUAeiF9D5U+DxEg14DRU7jWIT5IBIOdCxf+A+CQZAAoopEB7QJwBCBwHiip8UYmRdrAlDpIMgApwQZNnNii5Dq0MBgCxxycBnwEd+wAAAABJRU5ErkJggg=="/> |
| 7 | <style type="text/css"> | 7 | <style> |
| 8 | body{ | 8 | body{ |
| 9 | font-family: system-ui, -apple-system, Roboto, "Segoe UI", sans-serif; | 9 | font-family: system-ui, -apple-system, Roboto, "Segoe UI", sans-serif; |
| 10 | } | 10 | } |
| ... | @@ -511,7 +511,7 @@ pub fn main() void { | ... | @@ -511,7 +511,7 @@ pub fn main() void { |
| 511 | </div> | 511 | </div> |
| 512 | <p> | 512 | <p> |
| 513 | In addition to the integer types above, arbitrary bit-width integers can be referenced by using | 513 | In addition to the integer types above, arbitrary bit-width integers can be referenced by using |
| 514 | an identifier of <code>i</code> or </code>u</code> followed by digits. For example, the identifier | 514 | an identifier of <code>i</code> or <code>u</code> followed by digits. For example, the identifier |
| 515 | {#syntax#}i7{#endsyntax#} refers to a signed 7-bit integer. The maximum allowed bit-width of an | 515 | {#syntax#}i7{#endsyntax#} refers to a signed 7-bit integer. The maximum allowed bit-width of an |
| 516 | integer type is {#syntax#}65535{#endsyntax#}. | 516 | integer type is {#syntax#}65535{#endsyntax#}. |
| 517 | </p> | 517 | </p> |
| ... | @@ -878,7 +878,7 @@ fn divide(a: i32, b: i32) i32 { | ... | @@ -878,7 +878,7 @@ fn divide(a: i32, b: i32) i32 { |
| 878 | </p> | 878 | </p> |
| 879 | <p> | 879 | <p> |
| 880 | Zig supports arbitrary bit-width integers, referenced by using | 880 | Zig supports arbitrary bit-width integers, referenced by using |
| 881 | an identifier of <code>i</code> or </code>u</code> followed by digits. For example, the identifier | 881 | an identifier of <code>i</code> or <code>u</code> followed by digits. For example, the identifier |
| 882 | {#syntax#}i7{#endsyntax#} refers to a signed 7-bit integer. The maximum allowed bit-width of an | 882 | {#syntax#}i7{#endsyntax#} refers to a signed 7-bit integer. The maximum allowed bit-width of an |
| 883 | integer type is {#syntax#}65535{#endsyntax#}. | 883 | integer type is {#syntax#}65535{#endsyntax#}. |
| 884 | </p> | 884 | </p> |
| ... | @@ -5445,8 +5445,6 @@ fn gimmeTheBiggerInteger(a: u64, b: u64) u64 { | ... | @@ -5445,8 +5445,6 @@ fn gimmeTheBiggerInteger(a: u64, b: u64) u64 { |
| 5445 | <li>In the function definition, the value is known at compile-time.</li> | 5445 | <li>In the function definition, the value is known at compile-time.</li> |
| 5446 | </ul> | 5446 | </ul> |
| 5447 | <p> | 5447 | <p> |
| 5448 | </p> | | |
| 5449 | <p> | | |
| 5450 | For example, if we were to introduce another function to the above snippet: | 5448 | For example, if we were to introduce another function to the above snippet: |
| 5451 | </p> | 5449 | </p> |
| 5452 | {#code_begin|test_err|values of type 'type' must be comptime known#} | 5450 | {#code_begin|test_err|values of type 'type' must be comptime known#} |
| ... | @@ -6891,7 +6889,7 @@ async fn func(y: *i32) void { | ... | @@ -6891,7 +6889,7 @@ async fn func(y: *i32) void { |
| 6891 | This function can only occur inside {#syntax#}@cImport{#endsyntax#}. | 6889 | This function can only occur inside {#syntax#}@cImport{#endsyntax#}. |
| 6892 | </p> | 6890 | </p> |
| 6893 | <p> | 6891 | <p> |
| 6894 | This appends <code>#include <$path>\n</code> to the {#syntax#}c_import{#endsyntax#} | 6892 | This appends <code>#include &lt;$path&gt;\n</code> to the {#syntax#}c_import{#endsyntax#} |
| 6895 | temporary buffer. | 6893 | temporary buffer. |
| 6896 | </p> | 6894 | </p> |
| 6897 | {#see_also|Import from C Header File|@cImport|@cDefine|@cUndef#} | 6895 | {#see_also|Import from C Header File|@cImport|@cDefine|@cUndef#} |
| ... | @@ -7015,7 +7013,6 @@ test "main" { | ... | @@ -7015,7 +7013,6 @@ test "main" { |
| 7015 | warn("Runtime in main, num1 = {}.\n", num1); | 7013 | warn("Runtime in main, num1 = {}.\n", num1); |
| 7016 | } | 7014 | } |
| 7017 | {#code_end#} | 7015 | {#code_end#} |
| 7018 | </p> | | |
| 7019 | <p> | 7016 | <p> |
| 7020 | will ouput: | 7017 | will ouput: |
| 7021 | </p> | 7018 | </p> |
| ... | @@ -8226,7 +8223,7 @@ test "integer truncation" { | ... | @@ -8226,7 +8223,7 @@ test "integer truncation" { |
| 8226 | <li>{#syntax#}noreturn{#endsyntax#}</li> | 8223 | <li>{#syntax#}noreturn{#endsyntax#}</li> |
| 8227 | <li>{#syntax#}void{#endsyntax#}</li> | 8224 | <li>{#syntax#}void{#endsyntax#}</li> |
| 8228 | <li>{#syntax#}bool{#endsyntax#}</li> | 8225 | <li>{#syntax#}bool{#endsyntax#}</li> |
| 8229 | <li>{#link|Integers#}</li> - The maximum bit count for an integer type is {#syntax#}65535{#endsyntax#}. | 8226 | <li>{#link|Integers#} - The maximum bit count for an integer type is {#syntax#}65535{#endsyntax#}.</li> |
| 8230 | <li>{#link|Floats#}</li> | 8227 | <li>{#link|Floats#}</li> |
| 8231 | <li>{#link|Pointers#}</li> | 8228 | <li>{#link|Pointers#}</li> |
| 8232 | <li>{#syntax#}comptime_int{#endsyntax#}</li> | 8229 | <li>{#syntax#}comptime_int{#endsyntax#}</li> |
| ... | @@ -8620,7 +8617,7 @@ pub fn build(b: *Builder) void { | ... | @@ -8620,7 +8617,7 @@ pub fn build(b: *Builder) void { |
| 8620 | {#header_close#} | 8617 | {#header_close#} |
| 8621 | | 8618 | |
| 8622 | {#header_open|Single Threaded Builds#} | 8619 | {#header_open|Single Threaded Builds#} |
| 8623 | <p>Zig has a compile option <code>--single-threaded</code> which has the following effects: | 8620 | <p>Zig has a compile option <code>--single-threaded</code> which has the following effects:</p> |
| 8624 | <ul> | 8621 | <ul> |
| 8625 | <li>All {#link|Thread Local Variables#} are treated as {#link|Global Variables#}.</li> | 8622 | <li>All {#link|Thread Local Variables#} are treated as {#link|Global Variables#}.</li> |
| 8626 | <li>The overhead of {#link|Async Functions#} becomes equivalent to function call overhead.</li> | 8623 | <li>The overhead of {#link|Async Functions#} becomes equivalent to function call overhead.</li> |
| ... | @@ -8629,7 +8626,6 @@ pub fn build(b: *Builder) void { | ... | @@ -8629,7 +8626,6 @@ pub fn build(b: *Builder) void { |
| 8629 | For example {#syntax#}std.Mutex{#endsyntax#} becomes | 8626 | For example {#syntax#}std.Mutex{#endsyntax#} becomes |
| 8630 | an empty data structure and all of its functions become no-ops.</li> | 8627 | an empty data structure and all of its functions become no-ops.</li> |
| 8631 | </ul> | 8628 | </ul> |
| 8632 | </p> | | |
| 8633 | {#header_close#} | 8629 | {#header_close#} |
| 8634 | | 8630 | |
| 8635 | {#header_open|Undefined Behavior#} | 8631 | {#header_open|Undefined Behavior#} |
| ... | @@ -9410,7 +9406,7 @@ test "string literal to constant slice" { | ... | @@ -9410,7 +9406,7 @@ test "string literal to constant slice" { |
| 9410 | The location of memory allocated with {#syntax#}allocator.alloc{#endsyntax#} or | 9406 | The location of memory allocated with {#syntax#}allocator.alloc{#endsyntax#} or |
| 9411 | {#syntax#}allocator.create{#endsyntax#} is determined by the allocator's implementation. | 9407 | {#syntax#}allocator.create{#endsyntax#} is determined by the allocator's implementation. |
| 9412 | </p> | 9408 | </p> |
| 9413 | </p>TODO: thread local variables</p> | 9409 | <p>TODO: thread local variables</p> |
| 9414 | {#header_close#} | 9410 | {#header_close#} |
| 9415 | | 9411 | |
| 9416 | {#header_open|Implementing an Allocator#} | 9412 | {#header_open|Implementing an Allocator#} |