parenthesize a negative literal under a unary operator
A negative literal is one token in Sex and two in C, so (- -1) came out --1, which C reads as decrementing a constant.
This commit is contained in:
@@ -9,7 +9,8 @@
|
||||
"closure in place: 5"
|
||||
"a type is not a call: 7"
|
||||
"radix literals: 224 5 128"
|
||||
"a double reaches C whole: 1")
|
||||
"a double reaches C whole: 1"
|
||||
"negated literals: 1 2.5")
|
||||
(return 0)
|
||||
|
||||
;;; The walk types an expression by its head, and the heads it had a
|
||||
@@ -97,4 +98,8 @@
|
||||
;; ...and a double in all the digits it was written with
|
||||
(var sixth double (/ 1.0 6.0))
|
||||
(printf "a double reaches C whole: %d\n" (== 0.16666666666666666 sixth))
|
||||
|
||||
;; a negative literal is one token in Sex and two in C, and C reads a
|
||||
;; minus written before them as `--'
|
||||
(printf "negated literals: %d %g\n" (- -1) (- -2.5))
|
||||
(return 0))
|
||||
|
||||
Reference in New Issue
Block a user