Hex2C little bug ?

This forum is meant for questions and discussions about the X# language and tools
Post Reply
User avatar
Horst
Posts: 327
Joined: Tue Oct 13, 2015 3:27 pm

Hex2C little bug ?

Post by Horst »

Hello

Code: Select all

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

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

Re: Hex2C little bug ?

Post 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..
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
User avatar
Horst
Posts: 327
Joined: Tue Oct 13, 2015 3:27 pm

Re: Hex2C little bug ?

Post 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
FFF
Posts: 1522
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

Re: Hex2C little bug ?

Post 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...)
Regards
Karl
(on Win8.1/64, Xide32 2.19, X#2.19.0.2.)
User avatar
Chris
Posts: 4562
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: Hex2C little bug ?

Post 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...
Chris Pyrgas

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