BleuLlama / TinyBasicPlus

A C implementation of Tiny Basic, with a focus on support for Arduino
401 stars 117 forks source link

Integer constants silently overflow while parsing. #37

Closed drawkula closed 6 years ago

drawkula commented 6 years ago

Integer constants silently overflow while parsing.

Example run on Debian9/AMD64:

$ ./tbp 
Starting up TinyBasic Plus...

65362 bytes free.
OK
>print 32768
print 32768
-32768
>print -32769
print -32769
32767

The overflow happens on Arduini too.

BleuLlama commented 6 years ago

Numbers are stored as a 2 byte signed number. This is how Tiny Basic was implemented, and is fairly standard for some BASIC variants.

Sorry if this doesn't suit your needs, but hey, limitations are fun to work around, right? :)

I'm going to close this one as "as designed."