Subtraction with DWORD issue

This forum is meant for questions and discussions about the X# language and tools
Post Reply
boonnam
Posts: 88
Joined: Mon May 08, 2017 6:42 pm
Location: USA

Subtraction with DWORD issue

Post by boonnam »

I know DWORD can't be negative, but using DWORD in subtraction shouldn't be an issue, right? For example:
local sys_date as date
local dNewDate as date
local dwNum as dword

sys_date := Today() //4/9/2020
dwNum := 3
dNewDate := sys_date-dwNum


I'm expecting dNewDate to be 4/6/2020, in our XSharp conversion program, it crashed. The error is "Value to add was out of range.". If I cast it to INT, it works.

dNewDate := sys_date -(INT)dwNum
//dNewDate is 4/6/2020.


In this case we are using dword as subtraction, not making it negative. Any thought?

Thanks,
Boonnam
User avatar
Chris
Posts: 4573
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Subtraction with DWORD issue

Post by Chris »

Hi Boonam,

This is a known issue, will be fixed in the next build which should be released soon. I will send you a quick fix dll that you can use in the meantime
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
Post Reply