| ... | ... | @@ -1,10 +1,10 @@ |
| 1 | 1 | <!doctype html> |
| 2 | | <html> |
| 2 | <html lang="en"> |
| 3 | 3 | <head> |
| 4 | 4 | <meta charset="utf-8"> |
| 5 | 5 | <title>Documentation - The Zig Programming Language</title> |
| 6 | 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 | 8 | body{ |
| 9 | 9 | font-family: system-ui, -apple-system, Roboto, "Segoe UI", sans-serif; |
| 10 | 10 | } |
| ... | ... | @@ -511,7 +511,7 @@ pub fn main() void { |
| 511 | 511 | </div> |
| 512 | 512 | <p> |
| 513 | 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 | 515 | {#syntax#}i7{#endsyntax#} refers to a signed 7-bit integer. The maximum allowed bit-width of an |
| 516 | 516 | integer type is {#syntax#}65535{#endsyntax#}. |
| 517 | 517 | </p> |
| ... | ... | @@ -878,7 +878,7 @@ fn divide(a: i32, b: i32) i32 { |
| 878 | 878 | </p> |
| 879 | 879 | <p> |
| 880 | 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 | 882 | {#syntax#}i7{#endsyntax#} refers to a signed 7-bit integer. The maximum allowed bit-width of an |
| 883 | 883 | integer type is {#syntax#}65535{#endsyntax#}. |
| 884 | 884 | </p> |
| ... | ... | @@ -5445,8 +5445,6 @@ fn gimmeTheBiggerInteger(a: u64, b: u64) u64 { |
| 5445 | 5445 | <li>In the function definition, the value is known at compile-time.</li> |
| 5446 | 5446 | </ul> |
| 5447 | 5447 | <p> |
| 5448 | | </p> |
| 5449 | | <p> |
| 5450 | 5448 | For example, if we were to introduce another function to the above snippet: |
| 5451 | 5449 | </p> |
| 5452 | 5450 | {#code_begin|test_err|values of type 'type' must be comptime known#} |
| ... | ... | @@ -6006,7 +6004,7 @@ pub fn main() void { |
| 6006 | 6004 | {#target_linux_x86_64#} |
| 6007 | 6005 | pub fn main() noreturn { |
| 6008 | 6006 | const msg = "hello world\n"; |
| 6009 | | _ = syscall3(SYS_write, STDOUT_FILENO, @ptrToInt(&msg), msg.len); |
| 6007 | _ = syscall3(SYS_write, STDOUT_FILENO, @ptrToInt(msg), msg.len); |
| 6010 | 6008 | _ = syscall1(SYS_exit, 0); |
| 6011 | 6009 | unreachable; |
| 6012 | 6010 | } |
| ... | ... | @@ -6891,7 +6889,7 @@ async fn func(y: *i32) void { |
| 6891 | 6889 | This function can only occur inside {#syntax#}@cImport{#endsyntax#}. |
| 6892 | 6890 | </p> |
| 6893 | 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 | 6893 | temporary buffer. |
| 6896 | 6894 | </p> |
| 6897 | 6895 | {#see_also|Import from C Header File|@cImport|@cDefine|@cUndef#} |
| ... | ... | @@ -7015,7 +7013,6 @@ test "main" { |
| 7015 | 7013 | warn("Runtime in main, num1 = {}.\n", num1); |
| 7016 | 7014 | } |
| 7017 | 7015 | {#code_end#} |
| 7018 | | </p> |
| 7019 | 7016 | <p> |
| 7020 | 7017 | will ouput: |
| 7021 | 7018 | </p> |
| ... | ... | @@ -8226,7 +8223,7 @@ test "integer truncation" { |
| 8226 | 8223 | <li>{#syntax#}noreturn{#endsyntax#}</li> |
| 8227 | 8224 | <li>{#syntax#}void{#endsyntax#}</li> |
| 8228 | 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 | 8227 | <li>{#link|Floats#}</li> |
| 8231 | 8228 | <li>{#link|Pointers#}</li> |
| 8232 | 8229 | <li>{#syntax#}comptime_int{#endsyntax#}</li> |
| ... | ... | @@ -8620,7 +8617,7 @@ pub fn build(b: *Builder) void { |
| 8620 | 8617 | {#header_close#} |
| 8621 | 8618 | |
| 8622 | 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 | 8621 | <ul> |
| 8625 | 8622 | <li>All {#link|Thread Local Variables#} are treated as {#link|Global Variables#}.</li> |
| 8626 | 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 | 8626 | For example {#syntax#}std.Mutex{#endsyntax#} becomes |
| 8630 | 8627 | an empty data structure and all of its functions become no-ops.</li> |
| 8631 | 8628 | </ul> |
| 8632 | | </p> |
| 8633 | 8629 | {#header_close#} |
| 8634 | 8630 | |
| 8635 | 8631 | {#header_open|Undefined Behavior#} |
| ... | ... | @@ -9410,7 +9406,7 @@ test "string literal to constant slice" { |
| 9410 | 9406 | The location of memory allocated with {#syntax#}allocator.alloc{#endsyntax#} or |
| 9411 | 9407 | {#syntax#}allocator.create{#endsyntax#} is determined by the allocator's implementation. |
| 9412 | 9408 | </p> |
| 9413 | | </p>TODO: thread local variables</p> |
| 9409 | <p>TODO: thread local variables</p> |
| 9414 | 9410 | {#header_close#} |
| 9415 | 9411 | |
| 9416 | 9412 | {#header_open|Implementing an Allocator#} |