Greg Stein wrote:
On Mon, 8 May 2000, Christian Tismer wrote:
So long as negative literals don't exist in the grammar, "-2147483648" makes no sense on a 2's-complement machine with 32-bit C longs. There isn't "a problem" here worth fixing, although if there is <wink>, it will get fixed by magic as soon as Python ints and longs are unified.
I'd change the grammar.
That would be very difficult, with very little positive benefit. As Mark said, use 0x80000000 if you want that number.
Consider that the grammar would probably want to deal with things like
Instead, the grammar sees two parts: "-" and "NUMBER" without needing to complicate the syntax for NUMBER.
Right. That was the reason for my first, dumb, proposal: Always interpret a number as negative and negate it once more. That makes it positive. In a post process, remove double-negates. This leaves negations always where they are allowed: On negatives.
ciao - chris