| ... | @@ -247,8 +247,7 @@ pub fn main() void { | ... | @@ -247,8 +247,7 @@ pub fn main() void { |
| 247 | } | 247 | } |
| 248 | {#code_end#} | 248 | {#code_end#} |
| 249 | <p> | 249 | <p> |
| 250 | Note that we also left off the {#syntax#}!{#endsyntax#} from the return type. | 250 | Note that you can leave off the {#syntax#}!{#endsyntax#} from the return type because {#syntax#}warn{#endsyntax#} cannot fail. |
| 251 | In Zig, if your main function cannot fail, you must use the {#syntax#}void{#endsyntax#} return type. | | |
| 252 | </p> | 251 | </p> |
| 253 | {#see_also|Values|@import|Errors|Root Source File#} | 252 | {#see_also|Values|@import|Errors|Root Source File#} |
| 254 | {#header_close#} | 253 | {#header_close#} |
| ... | @@ -985,7 +984,7 @@ export fn foo_strict(x: f64) f64 { | ... | @@ -985,7 +984,7 @@ export fn foo_strict(x: f64) f64 { |
| 985 | } | 984 | } |
| 986 | | 985 | |
| 987 | export fn foo_optimized(x: f64) f64 { | 986 | export fn foo_optimized(x: f64) f64 { |
| 988 | @setFloatMode(builtin.FloatMode.Optimized); | 987 | @setFloatMode(.Optimized); |
| 989 | return x + big - big; | 988 | return x + big - big; |
| 990 | } | 989 | } |
| 991 | {#code_end#} | 990 | {#code_end#} |
| ... | @@ -2992,7 +2991,7 @@ test "simple union" { | ... | @@ -2992,7 +2991,7 @@ test "simple union" { |
| 2992 | This turns the union into a <em>tagged</em> union, which makes it eligible | 2991 | This turns the union into a <em>tagged</em> union, which makes it eligible |
| 2993 | to use with {#link|switch#} expressions. One can use {#link|@TagType#} to | 2992 | to use with {#link|switch#} expressions. One can use {#link|@TagType#} to |
| 2994 | obtain the enum type from the union type. | 2993 | obtain the enum type from the union type. |
| 2995 | Tagged unions coerce to their enum {#link|Type Coercion: unions and enums#} | 2994 | Tagged unions coerce to their tag type: {#link|Type Coercion: unions and enums#}. |
| 2996 | </p> | 2995 | </p> |
| 2997 | {#code_begin|test#} | 2996 | {#code_begin|test#} |
| 2998 | const std = @import("std"); | 2997 | const std = @import("std"); |
| ... | @@ -9479,7 +9478,7 @@ pub fn main() void { | ... | @@ -9479,7 +9478,7 @@ pub fn main() void { |
| 9479 | const builtin = @import("builtin"); | 9478 | const builtin = @import("builtin"); |
| 9480 | | 9479 | |
| 9481 | const c = @cImport({ | 9480 | const c = @cImport({ |
| 9482 | @cDefine("NDEBUG", builtin.mode == builtin.Mode.ReleaseFast); | 9481 | @cDefine("NDEBUG", builtin.mode == .ReleaseFast); |
| 9483 | if (something) { | 9482 | if (something) { |
| 9484 | @cDefine("_GNU_SOURCE", {}); | 9483 | @cDefine("_GNU_SOURCE", {}); |
| 9485 | } | 9484 | } |
| ... | @@ -10077,7 +10076,6 @@ fn readU32Be() u32 {} | ... | @@ -10077,7 +10076,6 @@ fn readU32Be() u32 {} |
| 10077 | {#header_open|Keyword: pub#} | 10076 | {#header_open|Keyword: pub#} |
| 10078 | <p>The {#syntax#}pub{#endsyntax#} in front of a top level declaration makes the | 10077 | <p>The {#syntax#}pub{#endsyntax#} in front of a top level declaration makes the |
| 10079 | declaration available to reference from a different file than the one it is declared in.</p> | 10078 | declaration available to reference from a different file than the one it is declared in.</p> |
| 10080 | <p><a href="https://github.com/ziglang/zig/issues/2059">TODO delete pub syntax for fields, or make it do something.</a></p> | | |
| 10081 | {#see_also|@import#} | 10079 | {#see_also|@import#} |
| 10082 | {#header_close#} | 10080 | {#header_close#} |
| 10083 | {#header_close#} | 10081 | {#header_close#} |