group a number's digits with _

C23 groups them with ', which in Sex is quote, so 1'000 read as 1 and
(quote 0); _ between two digits is dropped instead, and anywhere else
stays part of a name.
This commit is contained in:
2026-10-16 14:42:20 +03:00
parent 8ddeac7bab
commit 4463f796f8
3 changed files with 48 additions and 22 deletions

View File

@@ -769,6 +769,8 @@
(test-assert "a float keeps its digits, which a double would round"
(emits? (in-fn "(var x (long double) 3.14159265358979323846264338327950288L)")
"x = 3.14159265358979323846264338327950288L;"))
(test-assert "grouped digits reach C ungrouped"
(emits? (in-fn "(var x float 1_000.5f)") "x = 1000.5f;"))
(test-assert "a minus is C's own"
(emits? (in-fn "(var n (unsigned int) -1u)") "n = -1u;"))
(test-assert "a number too wide for long long is unsigned, and says so"