aboutsummaryrefslogtreecommitdiff
path: root/docs/SPEC.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/SPEC.md')
-rw-r--r--docs/SPEC.md2
1 files changed, 2 insertions, 0 deletions
diff --git a/docs/SPEC.md b/docs/SPEC.md
index b2aa5ea..266a1af 100644
--- a/docs/SPEC.md
+++ b/docs/SPEC.md
@@ -469,6 +469,8 @@ pn((int)(p + 1) - (int)p); // 1: p + 1 moves one word
3.11.6 `heap(e)` copies the value of `e` into a fresh owned heap block sized to it and returns a pointer to the block (a fresh object, 6.1): one word for a scalar or pointer (`heap(10)` is an `int*`), the characters and the terminating 0 for a `char*` word string (`heap("hi")` is a `char*`), and `sizeof(T)` words for a struct or array value (`heap(v)` with `v` a `foo` is a `foo*`). pointer fields of a copied struct are copied as plain words. a struct whose body declares `drop` gives the block its type drop (6.15). `heap` is found only when no variable or function of that name is in scope.
+3.11.7 `std.Io.print(args)` and `std.Io.println(args)` take any number of arguments, including none. each argument is evaluated left to right and written by the writer for its type: a byte string (`bstr`) by `put_bs`, a float by `put_f`, a `char*` or `char[]` by `put_s`, anything else by `put_n`. a fresh owned string argument is written and then freed; another fresh object is error: a new object can't be printed; bind it to a name first. `println` then writes a line break. the call's value is 0. these two are the only calls with a variable number of arguments.
+
### 3.12 `sizeof` and `typeof`
3.12.1 `sizeof(T)` and `sizeof(e)` give the size in words. the expression form is compiled but never run: `int i = 0; int n = sizeof(i++);` leaves `i` 0 and `n` 1. a `u8[100]` is 13 words, a struct of four `u8` fields is 1.