| ... | @@ -624,11 +624,6 @@ | ... | @@ -624,11 +624,6 @@ |
| 624 | <td><code class="c">void</code></td> | 624 | <td><code class="c">void</code></td> |
| 625 | <td>Used for type-erased pointers.</td> | 625 | <td>Used for type-erased pointers.</td> |
| 626 | </tr> | 626 | </tr> |
| 627 | <tr> | | |
| 628 | <th scope="row">{#syntax#}void{#endsyntax#}</th> | | |
| 629 | <td>(none)</td> | | |
| 630 | <td>Always the value {#syntax#}void{}{#endsyntax#}</td> | | |
| 631 | </tr> | | |
| 632 | <tr> | 627 | <tr> |
| 633 | <th scope="row">{#syntax#}noreturn{#endsyntax#}</th> | 628 | <th scope="row">{#syntax#}noreturn{#endsyntax#}</th> |
| 634 | <td>(none)</td> | 629 | <td>(none)</td> |
| ... | @@ -1806,25 +1801,6 @@ const together = array1 ++ array2; | ... | @@ -1806,25 +1801,6 @@ const together = array1 ++ array2; |
| 1806 | mem.eql(u32, &together, &[_]u32{1,2,3,4}){#endsyntax#}</pre> | 1801 | mem.eql(u32, &together, &[_]u32{1,2,3,4}){#endsyntax#}</pre> |
| 1807 | </td> | 1802 | </td> |
| 1808 | </tr> | 1803 | </tr> |
| 1809 | <tr> | | |
| 1810 | <td>Array Multiplication</td> | | |
| 1811 | <td><pre>{#syntax#}a ** b{#endsyntax#}</pre></td> | | |
| 1812 | <td> | | |
| 1813 | <ul> | | |
| 1814 | <li>{#link|Arrays#}</li> | | |
| 1815 | </ul> | | |
| 1816 | </td> | | |
| 1817 | <td> | | |
| 1818 | <ul> | | |
| 1819 | <li>Only available when the length of {#syntax#}a{#endsyntax#} and {#syntax#}b{#endsyntax#} are {#link|compile-time known|comptime#}.</li> | | |
| 1820 | </ul> | | |
| 1821 | </td> | | |
| 1822 | <td> | | |
| 1823 | <pre>{#syntax#}const mem = @import("std").mem; | | |
| 1824 | const pattern = "ab" ** 3; | | |
| 1825 | mem.eql(u8, pattern, "ababab"){#endsyntax#}</pre> | | |
| 1826 | </td> | | |
| 1827 | </tr> | | |
| 1828 | <tr> | 1804 | <tr> |
| 1829 | <td>Pointer Dereference</td> | 1805 | <td>Pointer Dereference</td> |
| 1830 | <td><pre>{#syntax#}a.*{#endsyntax#}</pre></td> | 1806 | <td><pre>{#syntax#}a.*{#endsyntax#}</pre></td> |
| ... | @@ -1882,7 +1858,7 @@ const B = error{Two}; | ... | @@ -1882,7 +1858,7 @@ const B = error{Two}; |
| 1882 | a!b | 1858 | a!b |
| 1883 | x{} | 1859 | x{} |
| 1884 | !x -x -%x ~x &x ?x | 1860 | !x -x -%x ~x &x ?x |
| 1885 | * / % ** *% *| || | 1861 | * / % *% *| || |
| 1886 | + - ++ +% -% +| -| | 1862 | + - ++ +% -% +| -| |
| 1887 | << >> <<| | 1863 | << >> <<| |
| 1888 | & ^ | orelse catch | 1864 | & ^ | orelse catch |
| ... | @@ -2371,7 +2347,7 @@ or | ... | @@ -2371,7 +2347,7 @@ or |
| 2371 | </p> | 2347 | </p> |
| 2372 | <p> | 2348 | <p> |
| 2373 | Like arrays, tuples have a .len field, can be indexed (provided the index is comptime-known) | 2349 | Like arrays, tuples have a .len field, can be indexed (provided the index is comptime-known) |
| 2374 | and work with the ++ and ** operators. They can also be iterated over with {#link|inline for#}. | 2350 | and work with the ++ operator. They can also be iterated over with {#link|inline for#}. |
| 2375 | </p> | 2351 | </p> |
| 2376 | {#code|test_tuples.zig#} | 2352 | {#code|test_tuples.zig#} |
| 2377 | | 2353 | |
| ... | @@ -2571,7 +2547,7 @@ or | ... | @@ -2571,7 +2547,7 @@ or |
| 2571 | {#header_close#} | 2547 | {#header_close#} |
| 2572 | | 2548 | |
| 2573 | {#header_open|Empty Blocks#} | 2549 | {#header_open|Empty Blocks#} |
| 2574 | <p>An empty block is equivalent to {#syntax#}void{}{#endsyntax#}:</p> | 2550 | <p>An empty block returns the single value of type {#syntax#}void{#endsyntax#}:</p> |
| 2575 | {#code|test_empty_block.zig#} | 2551 | {#code|test_empty_block.zig#} |
| 2576 | | 2552 | |
| 2577 | {#header_close#} | 2553 | {#header_close#} |
| ... | @@ -3159,10 +3135,6 @@ fn createFoo(param: i32) !Foo { | ... | @@ -3159,10 +3135,6 @@ fn createFoo(param: i32) !Foo { |
| 3159 | the verbosity and cognitive overhead of trying to make sure every exit path | 3135 | the verbosity and cognitive overhead of trying to make sure every exit path |
| 3160 | is covered. The deallocation code is always directly following the allocation code. | 3136 | is covered. The deallocation code is always directly following the allocation code. |
| 3161 | </p> | 3137 | </p> |
| 3162 | <p> | | |
| 3163 | The {#syntax#}errdefer{#endsyntax#} statement can optionally capture the error: | | |
| 3164 | </p> | | |
| 3165 | {#code|test_errdefer_capture.zig#} | | |
| 3166 | {#header_close#} | 3138 | {#header_close#} |
| 3167 | <p> | 3139 | <p> |
| 3168 | A couple of other tidbits about error handling: | 3140 | A couple of other tidbits about error handling: |
| ... | @@ -3627,7 +3599,7 @@ void do_a_thing(struct Foo *foo) { | ... | @@ -3627,7 +3599,7 @@ void do_a_thing(struct Foo *foo) { |
| 3627 | <p>For some types, {#link|@sizeOf#} is 0:</p> | 3599 | <p>For some types, {#link|@sizeOf#} is 0:</p> |
| 3628 | <ul> | 3600 | <ul> |
| 3629 | <li>{#link|void#}</li> | 3601 | <li>{#link|void#}</li> |
| 3630 | <li>The {#link|Integers#} {#syntax#}u0{#endsyntax#} and {#syntax#}i0{#endsyntax#}.</li> | 3602 | <li>The {#link|integer type|Integers#} {#syntax#}u0{#endsyntax#}.</li> |
| 3631 | <li>{#link|Arrays#} and {#link|Vectors#} with len 0, or with an element type that is a zero bit type.</li> | 3603 | <li>{#link|Arrays#} and {#link|Vectors#} with len 0, or with an element type that is a zero bit type.</li> |
| 3632 | <li>An {#link|enum#} with only 1 tag.</li> | 3604 | <li>An {#link|enum#} with only 1 tag.</li> |
| 3633 | <li>A {#link|struct#} with all fields being zero bit types.</li> | 3605 | <li>A {#link|struct#} with all fields being zero bit types.</li> |
| ... | @@ -8036,7 +8008,6 @@ MultiplyOp | ... | @@ -8036,7 +8008,6 @@ MultiplyOp |
| 8036 | / ASTERISK | 8008 | / ASTERISK |
| 8037 | / SLASH | 8009 | / SLASH |
| 8038 | / PERCENT | 8010 | / PERCENT |
| 8039 | / ASTERISK2 | | |
| 8040 | / ASTERISKPERCENT | 8011 | / ASTERISKPERCENT |
| 8041 | / ASTERISKPIPE | 8012 | / ASTERISKPIPE |
| 8042 | | 8013 | |
| ... | @@ -8083,11 +8054,11 @@ LabelableExpr | ... | @@ -8083,11 +8054,11 @@ LabelableExpr |
| 8083 | # Ptr specific | 8054 | # Ptr specific |
| 8084 | SliceTypeStart <- LBRACKET (COLON Expr)? RBRACKET | 8055 | SliceTypeStart <- LBRACKET (COLON Expr)? RBRACKET |
| 8085 | | 8056 | |
| 8086 | SinglePtrTypeStart <- ASTERISK / ASTERISK2 | 8057 | SinglePtrTypeStart <- ASTERISK |
| 8087 | | 8058 | |
| 8088 | ManyPtrTypeStart <- LBRACKET ASTERISK (LETTERC / COLON Expr)? RBRACKET | 8059 | ManyPtrTypeStart <- LBRACKET ASTERISK (LETTERC / COLON Expr)? RBRACKET |
| 8089 | | 8060 | |
| 8090 | ArrayTypeStart <- LBRACKET Expr !(ASTERISK / ASTERISK2) (COLON Expr)? RBRACKET | 8061 | ArrayTypeStart <- LBRACKET Expr !ASTERISK (COLON Expr)? RBRACKET |
| 8091 | | 8062 | |
| 8092 | # ContainerDecl specific | 8063 | # ContainerDecl specific |
| 8093 | ContainerDeclAuto <- ContainerDeclType LBRACE ContainerMembers RBRACE | 8064 | ContainerDeclAuto <- ContainerDeclType LBRACE ContainerMembers RBRACE |
| ... | @@ -8215,7 +8186,6 @@ BUILTINIDENTIFIER <- '@'[A-Za-z_][A-Za-z0-9_]* skip | ... | @@ -8215,7 +8186,6 @@ BUILTINIDENTIFIER <- '@'[A-Za-z_][A-Za-z0-9_]* skip |
| 8215 | AMPERSAND <- '&' ![=] skip | 8186 | AMPERSAND <- '&' ![=] skip |
| 8216 | AMPERSANDEQUAL <- '&=' skip | 8187 | AMPERSANDEQUAL <- '&=' skip |
| 8217 | ASTERISK <- '*' ![*%=|] skip | 8188 | ASTERISK <- '*' ![*%=|] skip |
| 8218 | ASTERISK2 <- '**' skip | | |
| 8219 | ASTERISKEQUAL <- '*=' skip | 8189 | ASTERISKEQUAL <- '*=' skip |
| 8220 | ASTERISKPERCENT <- '*%' ![=] skip | 8190 | ASTERISKPERCENT <- '*%' ![=] skip |
| 8221 | ASTERISKPERCENTEQUAL <- '*%=' skip | 8191 | ASTERISKPERCENTEQUAL <- '*%=' skip |