mIRC Homepage
Posted By: maroon $base prefix 0x - 12/08/18 08:51 PM
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.
Posted By: Khaled Re: $base prefix 0x - 28/09/18 05:12 PM
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.
Posted By: Wims Re: $base prefix 0x - 28/09/18 05:25 PM
It prevents one from using some bases correctly so it should definitely be dealt with. Yay for breaking backward comp cool
© mIRC Discussion Forums