diff --git a/doc/langref.html.in b/doc/langref.html.in index 0a44203b55..31d3b9b1ec 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -3249,6 +3249,31 @@ fn makeNumber() Number { {#header_close#} + {#header_open|opaque#} +
+ {#syntax#}opaque {}{#endsyntax#} declares a new type with an unknown (but non-zero) size and alignment. + It can contain declarations the same as {#link|structs|struct#}, {#link|unions|union#}, + and {#link|enums|enum#}. +
++ This is typically used for type safety when interacting with C code that does not expose struct details. + Example: +
+ {#code_begin|test_err|expected type '*Derp', found '*Wat'#} +const Derp = opaque {}; +const Wat = opaque {}; + +extern fn bar(d: *Derp) void; +fn foo(w: *Wat) callconv(.C) void { + bar(w); +} + +test "call foo" { + foo(undefined); +} + {#code_end#} + {#header_close#} + {#header_open|blocks#}Blocks are used to limit the scope of variable declarations: @@ -8547,31 +8572,6 @@ fn foo(comptime T: type, ptr: *T) T { {#header_close#} {#header_close#} - {#header_open|opaque#} -
- {#syntax#}opaque {}{#endsyntax#} declares a new type with an unknown (but non-zero) size and alignment. - It can contain declarations the same as {#link|structs|struct#}, {#link|unions|union#}, - and {#link|enums|enum#}. -
-- This is typically used for type safety when interacting with C code that does not expose struct details. - Example: -
- {#code_begin|test_err|expected type '*Derp', found '*Wat'#} -const Derp = opaque {}; -const Wat = opaque {}; - -extern fn bar(d: *Derp) void; -fn foo(w: *Wat) callconv(.C) void { - bar(w); -} - -test "call foo" { - foo(undefined); -} - {#code_end#} - {#header_close#} - {#header_open|Build Mode#}Zig has four build modes: @@ -9626,24 +9626,38 @@ test "assert in release fast mode" { isolation.
{#header_close#} - {#header_open|Zig Build System#} -Simple programs can be built with {#syntax#}zig - build-exe{#endsyntax#} and {#syntax#}zig build-lib{#endsyntax#}, - but running those commands manually gets tedious and error - prone. Zig's build system lets you keep all the command line - switches and build modes in one place. It has no external - dependencies, so Zig code can be built on any platform without - installing more programs.
-To use the build system, run
- $ zig build [command]
- where {#syntax#}[command]{#endsyntax#} is an optional target,
- configured by your build.zig file. There is more detail
- on the
- wiki but here are some example build.zig files to get you
- started:
+ The Zig Build System provides a cross-platform, dependency-free way to declare + the logic required to build a project. With this system, the logic to build + a project is written in a build.zig file, using the Zig Build System API to + declare and configure build artifacts and other tasks. +
++ Some examples of tasks the build system can help with: +
+zig fmt on a codebase or a subset of it.
+ To use the build system, run zig build --help
+ to see a command-line usage help menu. This will include project-specific
+ options that were declared in the build.zig script.
+
This build.zig file is automatically generated
by zig init-exe.
This build.zig file is automatically generated
+ by zig init-lib.
{#syntax#}
+lib.addCSourceFile("src/lib.c", &[_][]const u8{
+ "-Wall",
+ "-Wextra",
+ "-Werror",
+});
+ {#endsyntax#}
+ {#header_close#}
+
{#header_close#}
{#header_open|C#}