diff options
| author | 2026-10-14 17:00:26 +0330 | |
|---|---|---|
| committer | 2026-10-14 17:00:26 +0330 | |
| commit | 6ef2efb750622819a3ba3ae9ee061e512c1266d6 (patch) | |
| tree | 2c99f8f8691780bf6c57cccf405115f7b84ba0d1 /docs | |
| parent | prototypes: parameters may be unnamed, int f(int, int*); (appendix b.2.13) (diff) | |
len: len on a char* is an error with typecheck off too (appendix b.2.14)
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/SPEC.md | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/docs/SPEC.md b/docs/SPEC.md index 128f961..dd04cde 100644 --- a/docs/SPEC.md +++ b/docs/SPEC.md @@ -490,7 +490,7 @@ pn(pop(a)); pn(a.pop()); pn(a.len()); // 4 3 2 a[2]; // zy: index 2 out of range (length 2) ``` -3.13.5 the length of a non-array (`len("text")` on a `char*`) is unspecified when `typecheck` is off (it reads word 0) and error: len needs an array under `typecheck on;`. use `rt.len_w` for word strings and `len` for `bstr`. +3.13.5 `len` on a `char*` is error: len needs an array, not a char* when `typecheck` is off, and error: len needs an array under `typecheck on;`. use `rt.len_w` for word strings and `len` for `bstr`. ### 3.14 constant expressions @@ -1117,7 +1117,7 @@ each item gives a minimal program, the expected behavior (per this spec) and the 11. fixed (1.2.2): an unterminated `/* ...` comment was accepted silently; it is error: unterminated comment. (an unterminated string literal is still only reported as a later syntax error.) 12. settled (3.2.3): `x as int * y` parses `int*` as the type. this is the rule (the type is read greedily, as zc0 does too), so the program is a syntax error. 13. fixed (5.2.1): a prototype's parameters may be unnamed (`int f(int, int*);`). a lone type name counts as a type only in a prototype; with a body it is still the parameter's name, and an unnamed typed parameter there is `a parameter needs a name`. -14. `len(s)` on a `char*` returns word 0 of the string when `typecheck` is off. +14. fixed (3.13.5): `len(s)` on a `char*` used to return word 0 of the string when `typecheck` was off; it is now a compile error. 15. duplicate `case` labels are not diagnosed (4.7.2). 16. a local `const` cannot be used in a constant expression (b.1.7). 17. fixed: a bad float or character literal in a function's first statement was not reported (1.4). |
