aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-03-07 12:18:41 -0500
committerAndrew Kelley <andrew@ziglang.org>2020-03-07 12:18:41 -0500
commit96c07674fc2293fa040212ab797c05436dc515b1 (patch)
tree67b0bc649f4b4c384259a031269254a90078c0bd /doc
parentbc75c0de6c8227d1c01b59c0d63f4d012e05496f (diff)
parentabe7305e169be2047d65f96e6525d3828684f058 (diff)
downloadzig-96c07674fc2293fa040212ab797c05436dc515b1.tar.gz
zig-96c07674fc2293fa040212ab797c05436dc515b1.zip
Merge remote-tracking branch 'origin/master' into llvm10
Diffstat (limited to 'doc')
-rw-r--r--doc/langref.html.in20
1 files changed, 12 insertions, 8 deletions
diff --git a/doc/langref.html.in b/doc/langref.html.in
index 455d07b52f..a39f73cf96 100644
--- a/doc/langref.html.in
+++ b/doc/langref.html.in
@@ -7247,11 +7247,13 @@ test "main" {
{#see_also|@divFloor|@divExact#}
{#header_close#}
{#header_open|@embedFile#}
- <pre>{#syntax#}@embedFile(comptime path: []const u8) [X]u8{#endsyntax#}</pre>
+ <pre>{#syntax#}@embedFile(comptime path: []const u8) *const [X:0]u8{#endsyntax#}</pre>
<p>
- This function returns a compile time constant fixed-size array with length
- equal to the byte count of the file given by {#syntax#}path{#endsyntax#}. The contents of the array
- are the contents of the file.
+ This function returns a compile time constant pointer to null-terminated,
+ fixed-size array with length equal to the byte count of the file given by
+ {#syntax#}path{#endsyntax#}. The contents of the array are the contents of the file.
+ This is equivalent to a {#link|string literal|String Literals and Character Literals#}
+ with the file contents.
</p>
<p>
{#syntax#}path{#endsyntax#} is absolute or relative to the current file, just like {#syntax#}@import{#endsyntax#}.
@@ -8337,12 +8339,14 @@ test "integer truncation" {
{#header_close#}
{#header_open|@TypeOf#}
- <pre>{#syntax#}@TypeOf(expression) type{#endsyntax#}</pre>
+ <pre>{#syntax#}@TypeOf(...) type{#endsyntax#}</pre>
<p>
- This function returns a compile-time constant, which is the type of the
- expression passed as an argument. The expression is evaluated.
+ {#syntax#}@TypeOf{#endsyntax#} is a special builtin function that takes any (nonzero) number of expressions
+ as parameters and returns the type of the result, using {#link|Peer Type Resolution#}.
+ </p>
+ <p>
+ The expressions are evaluated, however they are guaranteed to have no <em>runtime</em> side-effects:
</p>
- <p>{#syntax#}@TypeOf{#endsyntax#} guarantees no run-time side-effects within the expression:</p>
{#code_begin|test#}
const std = @import("std");
const assert = std.debug.assert;