diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-02-09 02:50:03 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-02-09 03:09:25 -0500 |
| commit | fc100d7b3b27bd514dca4e02c160e5b96d4da648 (patch) | |
| tree | b365fbdf02c7a35d81d9037a15e1e3917a6e77de /doc/langref.md | |
| parent | 8a859afd580f438f549ee69a3e3487eb5d119fad (diff) | |
| download | zig-fc100d7b3b27bd514dca4e02c160e5b96d4da648.tar.gz zig-fc100d7b3b27bd514dca4e02c160e5b96d4da648.zip | |
lots of miscellaneous things all in one big commit
* add `@compileLog(...)` builtin function
- Helps debug code running at compile time
- See #240
* fix crash when there is an error on the start value of a slice
* add implicit cast from int and float types to int and float
literals if the value is known at compile time
* make array concatenation work with slices in addition to
arrays and c string literals
* fix compile error message for something not having field access
* fix crash when `@setDebugSafety()` was called from a
function being evaluated at compile-time
* fix compile-time evaluation of overflow math builtins.
* avoid debug safety panic handler in builtin.o and compiler_rt.o
since we use no debug safety in these modules anyway
* add compiler_rt functions for division on ARM
- Closes #254
* move default panic handler to std.debug so users can
call it manually
* std.io.printf supports a width in the format specifier
Diffstat (limited to 'doc/langref.md')
| -rw-r--r-- | doc/langref.md | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/doc/langref.md b/doc/langref.md index b8a6a5775a..0aace75996 100644 --- a/doc/langref.md +++ b/doc/langref.md @@ -639,10 +639,23 @@ const b: u8 = @truncate(u8, a); ### @compileError(comptime msg: []u8) -This function, when semantically analyzed, causes a compile error with the message `msg`. +This function, when semantically analyzed, causes a compile error with the +message `msg`. -There are several ways that code avoids being semantically checked, such as using `if` -or `switch` with compile time constants, and comptime functions. +There are several ways that code avoids being semantically checked, such as +using `if` or `switch` with compile time constants, and comptime functions. + +### @compileLog(args: ...) + +This function, when semantically analyzed, causes a compile error, but it does +not prevent compile-time code from continuing to run, and it otherwise does not +interfere with analysis. + +Each of the arguments will be serialized to a printable debug value and output +to stderr, and then a newline at the end. + +This function can be used to do "printf debugging" on compile-time executing +code. ### @intType(comptime is_signed: bool, comptime bit_count: u8) -> type |
