VO Compatible Arithmetic in X#

This forum is meant for questions and discussions about the X# language and tools
Post Reply
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

VO Compatible Arithmetic in X#

Post by wriedmann »

Hi Chris,
I have opened a new thread in the forums to answer to your website article.

And here is my opinion: please don't loose time to emulate this strange behavior!
Maybe invest the time to analys current code either through the XPorter/VO or with a separate tool to find problematic places in VO code.

Wolfgang
P.S. I'm currently helping an Italian customer to migrate his large VO 2.5 application to 2.8, and I'm really wondering how many things that make no sense were allowed by VO or sometimes are threated in a completely illogic manner
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
FFF
Posts: 1580
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

VO Compatible Arithmetic in X#

Post by FFF »

Wolfgang,
i'd second to "drop" this - although, i'm probably not qualified to talk, as a quick search all in my projects shows only a handful of "BYTES" ;)

Chris, what about the bigger types? "WORD" i find quite more... most are holding return vals from windows dialogs, so should be unproblematic.
Maybe it might make sense to build a tool to list "operations" on this types...
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
User avatar
SHirsch
Posts: 286
Joined: Tue Jan 30, 2018 8:23 am
Location: Germany

VO Compatible Arithmetic in X#

Post by SHirsch »

Hi,

I am happy that you find this. In some old codes a I wondered about some strange arithmetic behaviours.
I had to refactor code like this:

Code: Select all

n := BYTE(250) + BYTE(10) + BYTE(1)
to this:

Code: Select all

n := BYTE(250) + BYTE(10)
n := n + BYTE(1)
to have correct results.

My opinion: keep the dotnet standard.

Stefan
User avatar
Chris
Posts: 4906
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

VO Compatible Arithmetic in X#

Post by Chris »

Guys,

This has to do with all 3 types BYTE, WORD and SHORT. Everywhere you are using them in calculations, in some cases results (intermediate or final ones) might be overflowing to 8 bits or 16 bits and in other cases they may not. If you are using them just to store values, without doing calculations with them (or your calculations use small enough numbers so that they never overflow), then there is no potential problem.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
TerryB1
Posts: 306
Joined: Wed Jan 03, 2018 11:58 am

VO Compatible Arithmetic in X#

Post by TerryB1 »

Hi Chris

There are some things (sets of incompatibilities) that will simply defy all means of resolution within compiler logic.

If this is the case here, I'd suggest separate packages which effectively poke their noses back into the source code and amend as required.

They'd only be used once by those who need them to get everything "XSharped", or have I got the wrong end of the stick?

Terry
Post Reply