[Pas2js] Strict ordinal types

Michael Van Canneyt michael at freepascal.org
Thu Jan 18 12:51:31 CET 2018



On Thu, 18 Jan 2018, Mattias Gaertner wrote:

> On Tue, 16 Jan 2018 11:16:46 -0800
> Ralf Quint <freedos.la at gmail.com> wrote:
>
>> On 1/15/2018 2:40 PM, gabor wrote:
>> > Hello!
>> >
>> > Could ordinal types be more strict? For example adding var i: byte = 
>> > 200; ... i:=i+100; will result in i=44 instead of i=300. 
>> Sorry, but in this case you should get a range check error, as a "byte" 
>> can never be 300, unless that has changed recently and a byte isn't 8 
>> bits and therefor in a range of 0..255 anymore...
>
> Runtime range and overflow checks are not yet implemented. It's on my
> todo list.
>
> If I understand the proposal correctly, a directive should be added to
> emulate the modulo overflows of normal processors, which could help
> porting some code.

This is also how I understood it.

Michael.


More information about the Pas2js mailing list