Regarding the proposed Binray Literals Deprecation

wjoe invalid at example.com
Wed Sep 14 12:51:37 UTC 2022


On Tuesday, 13 September 2022 at 18:50:01 UTC, Walter Bright 
wrote:
> On 9/13/2022 11:07 AM, wjoe wrote:
>> Besides, I've had to use the tip of a pencil to count Fs in 
>> hex values.
>
> So have I. But I have only 1/4 as many digits to count, and 
> don't need to if there are 6 or fewer digits.

Neither do you if you have only 8 bit especially if you group 
them with underscores.
Even 16 bit would be easy to read like that.

ubyte foo = 0b0010_1011;
ubyte bar = 0x2b;

Task: flip bit 3.

foo: 1. overwrite bit 3 with a 0.

bar: 1. convert 2b to binary
      2. flip the bit
      3. convert that back to hex.

foo 1 step
bar 3 steps

Checking which bits are set ?

foo - it's obvious at a glance.
bar - 2 steps: convert to binary -> read the bit

which is user friendlier ?



More information about the Digitalmars-d mailing list