mIRC Home    About    Download    Register    News    Help

Print Thread
#263501 12/08/18 08:51 PM
Joined: Jan 2004
Posts: 2,127
maroon Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
0x prefix should not be stripped outside base 16.

versions.txt v5.71:

Quote:

36.Fixed bug in $base(), can handle larger values. It now also strips out 0x number prefix, eg. from 0x0809.


I agree this is nice to recognize the 0x prefix for base 16, but should it actually be recognized in any other 'from' base besides 16? Currently, the only one where the 0x prefix is not stripped is base36. At the very least, it should be fixed to also not-strip the 0x prefix in bases 34-35 where X is a valid character.

Code:
//var %i 2 , %a , %value F | while (%i isnum 2-36) { var %a %a $+(base,%i,=,$base(0x $+ %value,%i,10),vs,$base(%value,%i,10)) | inc %i } | echo -a %a



Also would be nice if 0x prefix were mentioned in /help.

maroon #263806 28/09/18 05:12 PM
Joined: Dec 2002
Posts: 5,486
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,486
Thanks for your bug report. This change was made eighteen years ago at the request of other scripters, so I am afraid I cannot remember their reasons for requesting this. However, I can change it - as long as no one has an issue with this, or foresees any backward compatibility problems, I will change $base() in the next beta to only remove 0x from base16.

Khaled #263807 28/09/18 05:25 PM
Joined: Jul 2006
Posts: 4,180
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,180
It prevents one from using some bases correctly so it should definitely be dealt with. Yay for breaking backward comp cool


#mircscripting @ irc.swiftirc.net == the best mIRC help channel

Link Copied to Clipboard