1
0
forked from alex-eg/sex

spell the least long long as C's LLONG_MIN

-9223372036854775808 reached C as written, where it negates an unsigned
constant, and had no type for inference: it is read as
-9223372036854775807 - 1, which is long long on both sides.
This commit is contained in:
2026-10-27 22:41:06 +03:00
parent 28aaaf637c
commit a2bbb73524
3 changed files with 12 additions and 5 deletions

View File

@@ -1190,7 +1190,10 @@
(emits? (in-fn "(var n (unsigned int) -1u)") "n = -1u;"))
(test-assert "a number too wide for long long is unsigned, and says so"
(emits? (in-fn "(var n (unsigned long long) 0xFFFFFFFFFFFFFFFF)")
"n = 18446744073709551615u;")))
"n = 18446744073709551615u;"))
(test-assert "the least long long is spelled as LLONG_MIN, and typed"
(emits? (in-fn "(var n _ -9223372036854775808)")
"long long n = -9223372036854775807 - 1;")))
;; A define's body was pasted unwalked, and unparenthesised: `cast'
;; stayed a call, and (* x D) regrouped with D's own operator