From 38ff4e782ef844a21512eb2ca0e491387ae89ec5 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Tue, 13 Oct 2026 05:25:09 +0000 Subject: fix: compare strings by content Co-Authored-By: Claude Fable 5.1 --- AGENTS/CONVENTIONS.md | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'AGENTS/CONVENTIONS.md') diff --git a/AGENTS/CONVENTIONS.md b/AGENTS/CONVENTIONS.md index 6681d1a..e2c6ebd 100644 --- a/AGENTS/CONVENTIONS.md +++ b/AGENTS/CONVENTIONS.md @@ -57,6 +57,13 @@ CHAR = `i8`, STRING = opaque `ptr` to a NUL-terminated buffer. Some code still i pseudocode types *backwards* from LLVM types (`getExprTypeInfo`'s fallback, `ArithmeticHandler`'s `isIntegerTy(64)` tests), so these widths are ABI. +**Reference storage does not imply address comparison.** Compare values by content; +only explicitly declared pointer types compare addresses. STRING's six comparison +operators use `strcmp` in `StringHandler`, dispatched by pseudocode type in CodeGen +before ArithmeticHandler. Ordering is case-sensitive byte lexicographic order; +mixed STRING/non-STRING comparisons are errors. Whole-array and record comparisons +remain unsupported. + **Strings are malloc'd and never freed — by design.** Every string-producing operation (`&`, MID/LEFT/RIGHT/LCASE/UCASE, NUM_TO_STR, CHR, READFILE, CHAR/number→STRING coercion) mallocs a fresh buffer; string literals and BOOLEAN→STRING coercion instead -- cgit v1.3.1-4-g156e