From 764c5d4561787796ae90576ab90485bc7e44fdec Mon Sep 17 00:00:00 2001 From: Joseph Ferano Date: Fri, 25 Sep 2026 10:12:56 +0700 Subject: [PATCH] Every string literal is to end in a NUL on both backends, and a literal crosses to C uncopied --- TODO.org | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/TODO.org b/TODO.org index 542a1ca8..eaf8fc9e 100644 --- a/TODO.org +++ b/TODO.org @@ -1120,7 +1120,8 @@ The module links and runs. What is not proved is a collection running while a li instance of a dyn-holding struct sits in a frame of a body that module delivered. For the next sweep rather than for a lane. -** TODO A sliced string loses the trailing NUL +** NEXT A sliced string loses the trailing NUL +Decided 2026-09-25: both backends emit a NUL after every string literal, and a declare-c wrapper passes a literal argument to C without the copy it makes for any other string. A string is still pointer and length; no slice is promised a NUL. Rules out a NUL guarantee on every string. The x86 backend emits a NUL after every string constant and the LLVM one does not, so a =declare-c= wrapper leaning on the courtesy is already backend-dependent as well as slice-dependent. The contract is pointer and length, and nothing promised