xsharp.eu • Hex2C little bug ?
Page 1 of 1

Hex2C little bug ?

Posted: Tue Dec 12, 2023 4:35 pm
by Horst
Hello

Code: Select all

? C2Hex ("336-")
? Hex2C ("636333d2")    // the - is gone
? Hex2C ("636333D2")
It's a bug ? Right?

Horst

Re: Hex2C little bug ?

Posted: Tue Dec 12, 2023 4:56 pm
by Chris
Hi Horst,

It looks like a bug, but then again VO seems to have the same behavior. Please try this in VO:

? Hex2C ( "3A" ) // ":"
? Hex2C ( "3a" ) // "0"

and X# gives the same results, so it is "correct".

I suspect this behavior of VO was unintentional (like in many other cases), but it's been like that forever, so I think it's probably better that we leave it alone like this..

Re: Hex2C little bug ?

Posted: Wed Dec 13, 2023 11:02 am
by Horst
Hello Chris

Ja i tested it in CAVO too and it's the same bug :-)
I run into a problem because i was using C2Hex and Hex2C to code a string like ArtikelNew04D212 , somewhere i was making lower () , and then the Hex2C brings a wrong result. Positve number instead of negativ.
I think this shoud be fixed, because in some years somebody will spend time again to find out whats wrong with his string.

Horst

Re: Hex2C little bug ?

Posted: Wed Dec 13, 2023 1:51 pm
by FFF
Horst wrote: Wed Dec 13, 2023 11:02 am ...
I think this shoud be fixed,
...
Yes. Add a clear note in the release notes, to do a global search and adjust code.
(BTW, i can't imagine coding that takes "advantage" of that bug...)

Re: Hex2C little bug ?

Posted: Wed Dec 13, 2023 3:53 pm
by Chris
Γθυσ,
FFF wrote: Wed Dec 13, 2023 1:51 pm
Horst wrote: Wed Dec 13, 2023 11:02 am ...
I think this shoud be fixed,
...
Yes. Add a clear note in the release notes, to do a global search and adjust code.
(BTW, i can't imagine coding that takes "advantage" of that bug...)
You would be very surprised to hear how many times we did things "right" in X#, only to eventually get complaints by some developers that their code is no longer working the same way as in VO, as it depended on some wrong (accidental) VO behavior. But if everybody agrees on this change, we can change it in X# of course...