zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 99adda9df5a5ae6c16b60da6ba7d57fd2154b81c (tree)
parent 043090020f5052fdee0fffc02dc7ef379ea63fd0
Author: John Schmidt <3405586+schmee@users.noreply.github.com>
Date:   Mon, 18 Feb 2019 23:53:41 +0100

Some function doc tweaks (#1961)

* Add docs for the inline function attribute

* Remove outdated comment

Seems like a leftover from when implicit returns were around.

* Consistent terminology

Diffstat:
Mdoc/langref.html.in | 9+++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/doc/langref.html.in b/doc/langref.html.in @@ -3169,7 +3169,6 @@ const assert = @import("std").debug.assert; // Functions are declared like this fn add(a: i8, b: i8) i8 { if (a == 0) { - // You can still return manually if needed. return b; } @@ -3193,12 +3192,18 @@ fn abort() noreturn { while (true) {} } -// nakedcc makes a function not have any function prologue or epilogue. +// The nakedcc specifier makes a function not have any function prologue or epilogue. // This can be useful when integrating with assembly. nakedcc fn _start() noreturn { abort(); } +// The inline specifier forces a function to be inlined at all call sites. +// If the function cannot be inlined, it is a compile-time error. +inline fn shiftLeftOne(a: u32) u32 { + return a << 1; +} + // The pub specifier allows the function to be visible when importing. // Another file can use @import and call sub2 pub fn sub2(a: i8, b: i8) i8 { return a - b; }